deepseek-ai/deepseek-harness · critical · ClientPackageCompositionError

client-modules: ${String(failures.length)} client ${packageN

Error message

client-modules: ${String(failures.length)} client ${packageNoun} failed to compose:

What it means

AggregateError thrown from the ClientModuleRegistry constructor's activation flush. The constructor scans all current Loader entries for packages declaring dsh.client; every per-package failure (missing built bundle, malformed declaration, unorderable module graph) is collected and rethrown as one ClientPackageCompositionError. Its message groups missing client bundles under the `pnpm run build` instruction and lists every other failure; the fiber lands FAILED at boot and the boot activation audit reports it.

Source

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

      if (entryName === undefined) return
      this.dirty.add(entryName)
      if (this.flushQueued) return
      this.flushQueued = true
      queueMicrotask(() => {
        this.flushQueued = false
        this.flush((err) => { ctx.logger.warn(err) })
      })
    })

    // Activation pass: the initial scan IS the incremental path over the
    // current entries, flushed synchronously (nothing async between subscribe,
    // seed, and flush).
    for (const entry of ctx.loader.entries()) this.dirty.add(entry.options.name)
    this.composed = this.compose()
    const failures: Error[] = []
    this.flush(err => failures.push(err))
    if (failures.length > 0) {
      throw new ClientPackageCompositionError(failures)
    }

    ctx.effect(
      () => ctx.webServer.register({ kind: 'prefix', path: '/plugins', handler: this.serveBundle }),
      'client-modules: bundle route',
    )
    ctx.on('webserver/index-inject', (table) => {
      table.push(...bootInjections(this.composed))
    })
  }

  /**
   * Current composed entry graph (stable object between changes).
   * @returns the graph served as `window.__DSH_BOOT__`.
   */
  graph(): WebBootGraph {
    return this.composed
  }

View on GitHub (pinned to b150a551b8)

Solutions

  1. Run `pnpm run build` and restart — the message itself instructs this, and unbuilt client bundles are the most common cause.
  2. For entries under 'other failures', fix each named package: validate its dsh.client fields (platform string, inject/external string arrays, immediately boolean) and its exports["./client"] entry.
  3. For a module graph cycle, break the synchronous request cycle in dsh.client.external — a requested package row must precede its consumers and factory-form CJS cannot deliver partial exports.
  4. Re-run and read the grouped message: every failing package and path is enumerated; fix them all in one pass instead of iterating boot-by-boot.

Example fix

# before — fresh clone, node-only tooling
pnpm install && pnpm dsh --profile web-app web
# client-modules: 3 client packages failed to compose: client bundles not found; run `pnpm run build`

# after
pnpm run build && pnpm dsh --profile web-app web
Defensive patterns

Strategy: try-catch

Validate before calling

import { existsSync } from 'node:fs'
// pre-boot: every dsh.client package's declared bundle must be on disk
for (const [name, clientPath] of declaredClientPaths()) {
  if (!existsSync(clientPath)) throw new Error(`${name}: ${clientPath} missing — run pnpm run build`)
}

Try / catch

try {
  await bootWebProfile()
} catch (error) {
  if (error instanceof AggregateError) {
    for (const inner of error.errors) {
      // missing-bundle entries carry package + path: build; others: fix the named declaration
      console.error(inner.message)
    }
  }
  throw error
}

Prevention

When it happens

Trigger: Starting the web profile when one or more dsh.client packages' built artifacts are absent (fresh clone without a client build), a package.json carries a malformed dsh.client declaration (non-string platform, non-array inject/external), or the composed set contains a module-graph cycle or self-request that orderByModuleGraph rejects during the same flush.

Common situations: Fresh clone plus `pnpm install` but no `pnpm run build`; a new client plugin package that fails the checklist (no ./client export, wrong dsh.client fields); dsh.client.external cycles between two packages; CI cache restoring sources without lib/ artifacts.

Related errors


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