{"record":{"id":"765936b04cbae3e3","repo":"deepseek-ai/deepseek-harness","slug":"agent-cap","errorCode":"AGENT_CAP","errorMessage":"this run reached its total agent cap (${this.limits.maxTotalAgents}) — a runaway-loop backstop; raise the applicable maxTotalAgents limit if the scale is intentional","messagePattern":"this run reached its total agent cap \\((.+?)\\) — a runaway-loop backstop; raise the applicable maxTotalAgents limit if the scale is intentional","errorType":"exception","errorClass":"WorkflowError","httpStatus":null,"severity":"error","filePath":"packages/workflow/workflow-worker-thread/src/runtime.ts","lineNumber":257,"sourceCode":"      })\n    })\n  }\n\n  private releaseSlot(): void {\n    this.activeSlots -= 1\n    const next = this.slotWaiters.shift()\n    if (next) next.resolve()\n  }\n\n  /** The `agent(prompt, opts)` hook. */\n  private async agent(rawPrompt: unknown, rawOpts: unknown): Promise<unknown> {\n    this.throwIfCancelled()\n    if (typeof rawPrompt !== 'string' || rawPrompt.length === 0) {\n      throw new WorkflowError('agent() requires a non-empty prompt string', 'INVALID_ARGUMENT')\n    }\n    const opts = this.readAgentOptions(rawOpts)\n    if (this.started >= this.limits.maxTotalAgents) {\n      throw new WorkflowError(\n        `this run reached its total agent cap (${this.limits.maxTotalAgents}) — a runaway-loop backstop; raise the applicable maxTotalAgents limit if the scale is intentional`,\n        'AGENT_CAP',\n      )\n    }\n    this.started += 1\n    const seq = this.started\n    const label = opts.label ?? defaultLabel(rawPrompt)\n    const phase = opts.phase ?? this.currentPhase\n\n    await this.acquireSlot()\n    try {\n      // Re-check after the acquire: the await yields at least one microtask\n      // tick even when a slot is free, and a queued waiter resumes a tick\n      // after its release — a cancel() landing in either window must not\n      // reach the host (which would refuse anyway, but the refusal reads as\n      // a start failure rather than the cancellation it is).\n      this.throwIfCancelled()\n      let run: ChildHandle","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/workflow/workflow-worker-thread/src/runtime.ts#L239-L275","documentation":"Error \"this run reached its total agent cap (${this.limits.maxTotalAgents}) — a runaway-loop backstop; raise the applicable maxTotalAgents limit if the scale is intentional\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/workflow/workflow-worker-thread/src/runtime.ts:257 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reduce agent() fan-out in the script (bound the loop), or raise maxTotalAgents in the engine config if the scale is intentional."],"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"}