{"record":{"id":"b2b5f96e381a77af","repo":"deepseek-ai/deepseek-harness","slug":"client-modules-html-did-not-preload-client-modu","errorCode":null,"errorMessage":"client-modules: HTML did not preload ${CLIENT_MODULES_ID}/client.js","messagePattern":"client-modules: HTML did not preload (.+?)/client\\.js","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"packages/client/modules/src/index.ts","lineNumber":253,"sourceCode":" * bundle, delegates construction to that bundle, and leaves the same facade\n * in live-registration mode. The graph global follows before the shell reads\n * it.\n * @param graph - the composed entry graph.\n * @returns head rows in execution order: queue script, preload scripts, graph global.\n */\nexport function bootInjections(graph: WebBootGraph): IndexInjection[] {\n  const bootstrapId = JSON.stringify(CLIENT_MODULES_ID)\n  const queue = `(()=>{\nconst pendingQueue=[]\nwindow.__ModuleLoader__={\n  mode:\"queue\",\n  pendingQueue,\n  load(registration){pendingQueue.push(registration)},\n  create(options){\n    if(this.mode!==\"queue\")throw new Error(\"client-modules: window.__ModuleLoader__.create called after module-system boot\")\n    const index=pendingQueue.findIndex(registration=>registration.id===${bootstrapId})\n    const registration=pendingQueue[index]\n    if(registration===undefined)throw new Error(\"client-modules: HTML did not preload ${CLIENT_MODULES_ID}/client.js\")\n    pendingQueue.splice(index,1)\n    const exports=registration.factory(specifier=>{\n      throw new Error('client-modules: ${CLIENT_MODULES_ID}/client.js requested external \"'+specifier+'\" before the module system existed')\n    })\n    if(typeof exports!==\"object\"||exports===null||typeof exports.createClientModuleSystem!==\"function\"||typeof exports.apply!==\"function\"){\n      throw new Error(\"client-modules: ${CLIENT_MODULES_ID}/client.js did not export the bootstrap module face\")\n    }\n    return exports.createClientModuleSystem(this,{id:registration.id,exports},options)\n  }\n}\n})()`\n  const preload = PARSER_PRELOAD_IDS.map(id => graph.entries.find(entry => entry.id === id))\n    .filter((entry): entry is WebBootEntry => entry !== undefined)\n    .map((entry): IndexInjection => ({ kind: 'script-src', placement: 'head', src: entry.url }))\n  return [\n    { kind: 'script', placement: 'head', text: queue },\n    ...preload,\n    { kind: 'global', name: '__DSH_BOOT__', value: graph },","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/client/modules/src/index.ts#L235-L271","documentation":"Thrown by the inline window.__ModuleLoader__ queue script that client-modules injects into every served HTML page. When the Vite shell calls __ModuleLoader__.create() to boot the module system, the pending queue must already contain a registration pushed by the preloaded '@deepseek-ai/dsh-client-modules/client.js' classic script. An empty match for that id means the parser-blocking preload script never executed: it was not injected into the HTML, failed to load (404 or network error), or was stripped by a custom template.","triggerScenarios":"window.__ModuleLoader__.create(options) runs before the head preload script /plugins/@deepseek-ai/dsh-client-modules/client.js?rev=... executed. Concretely: the served HTML lacks the script-src injection rows (custom index template or a 'webserver/index-inject' filter drops them), the preload URL returned 404 or SPA-fallback HTML so load() never ran, or a stale cached/proxied index.html from an older graph is served.","commonSituations":"Reverse proxy or browser cache returning an old index.html; a custom webserver template that filters head script injections; the /plugins prefix route missing because the modules node half is not active; ad blockers or a blocked path preventing the preload script from loading.","solutions":["Hard-reload (Ctrl/Cmd+Shift+R) and view-source: confirm <script src=\"/plugins/@deepseek-ai/dsh-client-modules/client.js?rev=...\"> is present in <head> before the shell script.","Open the preload URL directly; a 404 means the bundle file is missing on the host — run `pnpm run build` (or `pnpm --filter @deepseek-ai/dsh-client-modules bundle`) and restart the server.","If a custom index template or index-inject filter is in play, stop dropping the script-src rows contributed by client-modules; the queue script and preloads must precede the Vite shell.","Verify the client-modules node-half plugin is active (it owns the /plugins route and the injection rows); check the boot activation audit for a FAILED fiber."],"exampleFix":"// before — shell boot trusts the preload unconditionally\nconst system = window.__ModuleLoader__.create(options)\n\n// after — verify the bootstrap registration arrived before booting\nconst loader = window.__ModuleLoader__\nif (loader.mode === 'queue' &&\n    !loader.pendingQueue.some(r => r.id === '@deepseek-ai/dsh-client-modules')) {\n  throw new Error('boot aborted: /plugins/@deepseek-ai/dsh-client-modules/client.js did not preload — check for a 404 or stale HTML, then hard-reload')\n}\nconst system = loader.create(options)","handlingStrategy":"validation","validationCode":"function modulesBundlePreloaded() {\n  const loader = window.__ModuleLoader__\n  return loader !== undefined && loader.mode === 'queue'\n    && loader.pendingQueue.some(r => r.id === '@deepseek-ai/dsh-client-modules')\n}\nif (!modulesBundlePreloaded()) {\n  // surface boot diagnostics (preload 404 or stale HTML); do not call create()\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the client-modules node half enabled so its index-inject rows reach the served HTML.","Never filter script-src head injections in custom index templates.","Rebuild client bundles before launching or probing a live server.","Treat a 404 on /plugins/<id>/client.js as boot-blocking, not a soft miss."],"tags":["browser","boot","module-loader","preload"],"backgroundTag":"script-load-order","analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}