deepseek-ai/deepseek-harness · error

client-modules: require cycle through "${id}" (factory-form

Error message

client-modules: require cycle through "${id}" (factory-form CJS cannot deliver partial exports)

What it means

Error "client-modules: require cycle through "${id}" (factory-form CJS cannot deliver partial exports)" thrown in deepseek-ai/deepseek-harness.

Source

Thrown at packages/client/modules/src/client/system.ts:154

    const next = [...open, row.id]
    for (const request of row.external) {
      const id = stripClientSuffix(request)
      if (this.seed.has(request) || this.loadCache.has(id)) continue
      const dependency = this.graphRows.get(id)
      if (dependency !== undefined) await this.arriveGraphRow(dependency, next)
    }
    await this.arrive(row)
  }

  /** Materialize a registered factory (synchronous; memoized in loadCache). */
  private materialize(id: string): ClientModuleRecord {
    const existing = this.loadCache.get(id)
    if (existing !== undefined) return existing
    const registered = this.factories.get(id)
    /* v8 ignore next -- callers check the factory branch before dispatching here. */
    if (registered === undefined) throw new Error(`client-modules: no registered factory for "${id}"`)
    if (this.materializing.has(id)) {
      throw new Error(`client-modules: require cycle through "${id}" (factory-form CJS cannot deliver partial exports)`)
    }
    this.materializing.add(id)
    try {
      const edges = new Set<string>()
      const exports = registered(this.makeRequire(edges))
      const record: ClientModuleRecord = { id, exports, styles: claimStyles(id), edges }
      this.loadCache.set(id, record)
      return record
    } finally {
      this.materializing.delete(id)
    }
  }

  /**
   * The synchronous require answered to factories: seed → memoized record →
   * registered factory. Fetching is async and therefore unreachable
   * from here; an external dynamic package must have arrived before its
   * consumer materializes.

View on GitHub (pinned to b150a551b8)

Solutions

  1. Break the require cycle; factory-form CJS cannot deliver partial exports.

When it happens

Trigger: Thrown at packages/client/modules/src/client/system.ts:154 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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