#19250·cocos-engine

asset-db can start without any importers: its worker races engine-extends at editor start-up (3.8.8, macOS)

Author: dav-seaCreated Sep 28, 2026Updated Sep 28, 2026

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.effect and the start scene, is imported as cc.Asset;
  • .meta files 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-db is the first entry of scanPackage() in app.asar/launch/dist/launch.js. Its worker starts while the rest of the list is still being enabled.
  • The worker takes the asset-handler contributions 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] has enable: true and all its assetHandlerInfos. But its handlers never reach the asset handler manager: assetHandlerManager.name2registerInfo stays empty for the whole session, and a later reimport-asset still uses *.
  • engine-extends provides all 55 importers and is enabled after builtin/asset-db and all of editor-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-extends had reached the worker through the live task queue (it has a pkgLock entry), and name2registerInfo was empty.
  • In every good launch (23 of them), engine-extends was in the initial list, and name2registerInfo had 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:

diff
-"./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

  1. Create an empty 3.8.8 project and add the extension below to its extensions/ folder.
  2. 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.
  3. Each run prints the importer of the built-in effect after the asset-db is ready: effect means good, * means the race was lost. The worker script prints whether engine-extends reached the worker live and how many asset handlers are registered.

extensions/importer-probe/package.json:

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:

javascript
'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):

javascript
'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.