deepseek-ai/deepseek-harness · critical

client-modules: HTML did not preload ${CLIENT_MODULES_ID}/cl

Error message

client-modules: HTML did not preload ${CLIENT_MODULES_ID}/client.js

What it means

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.

Source

Thrown at packages/client/modules/src/index.ts:253

 * bundle, delegates construction to that bundle, and leaves the same facade
 * in live-registration mode. The graph global follows before the shell reads
 * it.
 * @param graph - the composed entry graph.
 * @returns head rows in execution order: queue script, preload scripts, graph global.
 */
export function bootInjections(graph: WebBootGraph): IndexInjection[] {
  const bootstrapId = JSON.stringify(CLIENT_MODULES_ID)
  const queue = `(()=>{
const pendingQueue=[]
window.__ModuleLoader__={
  mode:"queue",
  pendingQueue,
  load(registration){pendingQueue.push(registration)},
  create(options){
    if(this.mode!=="queue")throw new Error("client-modules: window.__ModuleLoader__.create called after module-system boot")
    const index=pendingQueue.findIndex(registration=>registration.id===${bootstrapId})
    const registration=pendingQueue[index]
    if(registration===undefined)throw new Error("client-modules: HTML did not preload ${CLIENT_MODULES_ID}/client.js")
    pendingQueue.splice(index,1)
    const exports=registration.factory(specifier=>{
      throw new Error('client-modules: ${CLIENT_MODULES_ID}/client.js requested external "'+specifier+'" before the module system existed')
    })
    if(typeof exports!=="object"||exports===null||typeof exports.createClientModuleSystem!=="function"||typeof exports.apply!=="function"){
      throw new Error("client-modules: ${CLIENT_MODULES_ID}/client.js did not export the bootstrap module face")
    }
    return exports.createClientModuleSystem(this,{id:registration.id,exports},options)
  }
}
})()`
  const preload = PARSER_PRELOAD_IDS.map(id => graph.entries.find(entry => entry.id === id))
    .filter((entry): entry is WebBootEntry => entry !== undefined)
    .map((entry): IndexInjection => ({ kind: 'script-src', placement: 'head', src: entry.url }))
  return [
    { kind: 'script', placement: 'head', text: queue },
    ...preload,
    { kind: 'global', name: '__DSH_BOOT__', value: graph },

View on GitHub (pinned to b150a551b8)

Solutions

  1. 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.
  2. 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.
  3. 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.
  4. 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.

Example fix

// before — shell boot trusts the preload unconditionally
const system = window.__ModuleLoader__.create(options)

// after — verify the bootstrap registration arrived before booting
const loader = window.__ModuleLoader__
if (loader.mode === 'queue' &&
    !loader.pendingQueue.some(r => r.id === '@deepseek-ai/dsh-client-modules')) {
  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')
}
const system = loader.create(options)
Defensive patterns

Strategy: validation

Validate before calling

function modulesBundlePreloaded() {
  const loader = window.__ModuleLoader__
  return loader !== undefined && loader.mode === 'queue'
    && loader.pendingQueue.some(r => r.id === '@deepseek-ai/dsh-client-modules')
}
if (!modulesBundlePreloaded()) {
  // surface boot diagnostics (preload 404 or stale HTML); do not call create()
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of deepseek-ai/deepseek-harness@b150a551b8 (2026-08-24). Data as JSON: /api/errors/b2b5f96e381a77af. Report an issue: GitHub.