asset-db can start without any importers: its worker races engine-extends at editor start-up (3.8.8, macOS)
Cocos Creator version
3.8.8, the official editor build: Electron 31.3.1, Node 20.15.1. Reproduced with the built-in engine and with a custom engine passed through --engine.
System information
macOS 26.6.2 (25G83) arm64 CI VMs: Apple M2 Pro (Virtual), 6 vCPU, 22 GB. Most frequent with CLI builds (--build); rare in the GUI editor. Never seen on our Windows Server 2025 x64 agents or on developer Macs.
Issue description
We run a lot of Cocos Creator builds on CI agents: macOS VMs for iOS, Windows VMs for Android and Web. On macOS the whole asset-db sometimes starts with only the fallback * importer:
- every asset, including
db://internal/effects/builtin-unlit.effectand the start scene, is imported ascc.Asset; .metafiles are rewritten to"importer": "*","ver": "0.0.1";- the CLI build fails with "The selected scene does not exist or is in a Bundle and cannot be set as the Start Scene".
This is not project data: an empty project reproduces it.
What we see at scale:
| Where | Attempts | Came up without importers |
|---|---|---|
| iOS CLI builds on macOS agents, before the agents' image was updated in early September | 49 | 0 |
| iOS CLI builds on macOS agents, after that update (the machines got faster) | 78 | 20 (26%) on the first launch; 17 (22%) failed the job after 3 launches |
| Retries of the same CLI build on the same macOS agent, after a failed first launch | 38 | 35 (92%) |
| Android and Web CLI builds on Windows agents, same editor version | ~410 | 0 |
| Automated GUI editor sessions on the same macOS agents, first launch | 45 | 1 |
A retry on the same machine almost never helps. A re-run of the job on a fresh agent usually does.
What happens:
builtin/asset-dbis the first entry ofscanPackage()inapp.asar/launch/dist/launch.js. Its worker starts while the rest of the list is still being enabled.- The worker takes the
asset-handlercontributions only of packages that were enabled before it took its initial package list. A package enabled later is registered in the worker's plugin manager:packageRegisterInfo[name]hasenable: trueand all itsassetHandlerInfos. But its handlers never reach the asset handler manager:assetHandlerManager.name2registerInfostays empty for the whole session, and a laterreimport-assetstill uses*. engine-extendsprovides all 55 importers and is enabled afterbuiltin/asset-dband all ofeditor-extensions. When the worker wins the race, there are no importers at all.
Evidence. On the same macOS agents we ran an empty project with a probe extension. It read the worker's own modules through require.cache: asset-db/dist/worker/manager/plugin.ccc and manager/asset-handler-manager.ccc.
| Launches | Came up without importers | |
|---|---|---|
| First CLI launch on a fresh agent | 18 | 6 (33%) |
| Relaunch on the same, now warm agent | 119 | 108 (91%) |
| Windows agents, same probe (3 first launches, 9 relaunches) | 12 | 0 |
- In every failing launch (114 of them),
engine-extendshad reached the worker through the live task queue (it has apkgLockentry), andname2registerInfowas empty. - In every good launch (23 of them),
engine-extendswas in the initial list, andname2registerInfohad 55 entries. - The race is decided by a few packages. In good launches the first package that reached the worker live was 1–5 packages after
engine-extends(the first platform extensions). In failing launches it was 0–6 packages before it (package-asset,process,reference-image,reflection-probe). - A warmer or faster machine starts the worker earlier: on macOS the worker started about 7.8 s after the main process on a fresh agent and about 2.5 s on a warm one. It then loses the race more often.
- This is probably also why the workarounds in #19107 (an editor already open, a different way of starting the build) help only sometimes: they only shift start-up timing.
Workaround: enable engine-extends before asset-db by appending it to scanPrePackage() in Contents/Resources/app.asar → launch/dist/launch.js. That list already carries device and ui-kit the same way:
-"./modules/editor-extensions/extensions/ui-kit"].forEach(
+"./modules/editor-extensions/extensions/ui-kit","./modules/engine-extensions/extensions/engine-extends"].forEach(The archive has to be repacked with updated offsets and a new integrity hash for that file. With this change on the same agents:
- all importers were present in 48 of 48 launches, 36 of them warm relaunches;
- 9 of 9 real iOS CLI builds passed, 6 of them repeated builds on the same agent.
A proper fix would either register the asset-handler contributions of packages enabled after the worker started, or start the databases only after the packages that contribute asset handlers are enabled.
Related: #19107 (the same symptom under Jenkins, 3.8.7+).
Relevant error log output
Warn: [Assets] Importer exec warning: {asset[<editor>/Contents/Resources/resources/3d/engine/editor/assets/default_file_content/animation-graph/ts-animation-graph](f102759d-fcb3-4103-82e5-9a955401466a)}: The importer version is lower than asset
Warn: [Assets] Importer exec warning: {asset[<editor>/…/default_file_content/effect-header/chunk](1f505ca8-b164-4d35-b697-504d100015e4)}: The importer version is lower than asset
Warn: [Assets] Importer exec warning: {asset[<editor>/…/default_file_content/typescript/ts](3e7d59d5-5478-474a-bb27-6eddb22dc614)}: The importer version is lower than asset
…
Error: The selected scene does not exist or is in a Bundle and cannot be set as the Start Scene.asset-db → query-asset-info → db://internal/effects/builtin-unlit.effect returns "importer": "*", "type": "cc.Asset" instead of "importer": "effect". In the GUI editor the scene does not open, and gizmos log illegal property name: mainColor.
Steps to reproduce
- Create an empty 3.8.8 project and add the extension below to its
extensions/folder. - On an affected macOS machine, run the CLI build a few times in a row:
CocosCreator --project <path> --build "platform=web-mobile". The second and later runs fail most often. - Each run prints the importer of the built-in effect after the asset-db is ready:
effectmeans good,*means the race was lost. The worker script prints whetherengine-extendsreached the worker live and how many asset handlers are registered.
extensions/importer-probe/package.json:
{
"package_version": 2,
"name": "importer-probe",
"version": "1.0.0",
"main": "./main.js",
"contributions": { "asset-db": { "script": "./worker.js" } }
}extensions/importer-probe/main.js:
'use strict';
exports.load = async function () {
while ((await Editor.Message.request('asset-db', 'query-ready')) !== true) {
await new Promise((resolve) => setTimeout(resolve, 500));
}
const info = await Editor.Message.request('asset-db', 'query-asset-info', 'db://internal/effects/builtin-unlit.effect');
console.log(`[importer-probe] builtin-unlit.effect was imported by '${info.importer}' as ${info.type}`);
};
exports.unload = function () {};extensions/importer-probe/worker.js (runs inside the asset-db worker):
'use strict';
exports.load = function () {
const find = (tail) => Object.keys(require.cache).find((file) => file.replace(/\\/g, '/').endsWith(tail));
const plugins = require.cache[find('asset-db/dist/worker/manager/plugin.ccc')].exports.default;
const handlers = require.cache[find('asset-db/dist/worker/manager/asset-handler-manager.ccc')].exports.assetHandlerManager;
console.log(`[importer-probe] engine-extends reached the worker live: ${'engine-extends' in plugins.pkgLock}; `
+ `registered asset handlers: ${Object.keys(handlers.name2registerInfo).length}`);
};Minimal reproduction project
An empty project with the extension above. The failure depends on start-up timing: on our macOS agents about a third of first CLI launches and ~90% of relaunches fail. On slower machines it may need many runs.
Source: cocos/cocos-engine