{"record":{"id":"67688ac624d57316","repo":"deepseek-ai/deepseek-harness","slug":"client-modules-module-graph-cycle-open-slic","errorCode":null,"errorMessage":"client-modules: module graph cycle ${[...open.slice(cycleStart), entry.id].join(' -> ')} — a requested package row must precede its consumers, and factory-form CJS cannot deliver partial exports","messagePattern":"client-modules: module graph cycle (.+?) — a requested package row must precede its consumers, and factory-form CJS cannot deliver partial exports","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/client/modules/src/index.ts","lineNumber":198,"sourceCode":" * consumers. An `external` specifier is either the package row it names\n * (`<pkg>/client` aliases the bare package) or a static-table name that adds no\n * graph edge.\n * @param entries - composed rows in scan order.\n * @returns the same rows reordered; scan order breaks every tie.\n * @throws {Error} when a row requests itself or when the module graph has a\n * cycle; the message lists the packages on it.\n */\nexport function orderByModuleGraph(entries: readonly WebBootEntry[]): WebBootEntry[] {\n  const rowsById = new Map<string, WebBootEntry>()\n  for (const entry of entries) rowsById.set(entry.id, entry)\n  const ordered: WebBootEntry[] = []\n  const placed = new Set<string>()\n  const open: string[] = []\n  const visit = (entry: WebBootEntry): void => {\n    if (placed.has(entry.id)) return\n    const cycleStart = open.indexOf(entry.id)\n    if (cycleStart !== -1) {\n      throw new Error(\n        `client-modules: module graph cycle ${[...open.slice(cycleStart), entry.id].join(' -> ')} `\n        + '— a requested package row must precede its consumers, and factory-form CJS cannot deliver partial exports',\n      )\n    }\n    open.push(entry.id)\n    for (const name of entry.external ?? []) {\n      const dependency = rowsById.get(name) ?? rowsById.get(stripClientSuffix(name))\n      if (dependency === entry) {\n        throw new Error(\n          `client-modules: \"${entry.id}\" requests module \"${name}\" that it answers itself `\n          + '— a row must not declare its own package in dsh.client.external',\n        )\n      }\n      if (dependency !== undefined) visit(dependency)\n    }\n    open.pop()\n    placed.add(entry.id)\n    ordered.push(entry)","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/client/modules/src/index.ts#L180-L216","documentation":"Error \"client-modules: module graph cycle ${[...open.slice(cycleStart), entry.id].join(' -> ')} — a requested package row must precede its consumers, and factory-form CJS cannot deliver partial exports\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/client/modules/src/index.ts:198 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Order requested package rows before their consumers and break the graph cycle."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}