{"record":{"id":"8bf5e235023802e4","repo":"JuliusBrussee/caveman","slug":"cave-claude-subagent-bridge-unavailable","errorCode":"cave_claude_subagent_bridge_unavailable","errorMessage":"cave_claude_subagent_bridge_unavailable","messagePattern":"cave_claude_subagent_bridge_unavailable","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/agent/src/claude-runtime.ts","lineNumber":98,"sourceCode":"async function runClaudeAgentWithOptions(\n  definition: AgentDefinition,\n  input: string,\n  options: ClaudeInternalRunOptions,\n): Promise<RunResult> {\n  if (options.lockedBuild !== undefined && options.candidatePlan !== undefined) {\n    throw new Error(\"cave_execution_authorization_ambiguous\");\n  }\n  if (options.candidatePlan !== undefined) {\n    throw new Error(\"cave_claude_candidate_execution_unavailable\");\n  }\n  if (options.lockedBuild !== undefined) {\n    throw new Error(\"cave_claude_locked_execution_unavailable\");\n  }\n  if (definition.memory !== undefined) {\n    throw new Error(\"cave_claude_memory_bridge_unavailable\");\n  }\n  if (definition.tools.some((item) => item.runtime?.kind === \"subagent\")) {\n    throw new Error(\"cave_claude_subagent_bridge_unavailable\");\n  }\n  const unsupportedTool = definition.tools.find((item) =>\n    item.effect !== \"read\" || item.result !== \"inline\");\n  if (unsupportedTool !== undefined) {\n    throw new Error(`cave_claude_tool_contract_unsupported:${unsupportedTool.name}`);\n  }\n  if (options.maxTurns !== undefined &&\n      (!Number.isSafeInteger(options.maxTurns) || options.maxTurns <= 0 || options.maxTurns > 1_000)) {\n    throw new Error(\"cave_claude_max_turns_invalid\");\n  }\n  if (options.maxBudgetUsd !== undefined &&\n      (!Number.isFinite(options.maxBudgetUsd) || options.maxBudgetUsd <= 0)) {\n    throw new Error(\"cave_claude_max_budget_invalid\");\n  }\n  const rootDir = resolve(options.rootDir ?? process.cwd());\n  const lowered = await lowerAgentContext(definition, { rootDir, input });\n  const bill = contextBill(lowered.ir);\n  const selected = resolveClaudeModel(definition, rootDir);","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/agent/src/claude-runtime.ts#L80-L116","documentation":"Fail-closed guard in runClaudeAgentWithOptions: the definition includes a tool whose runtime kind is 'subagent', but the Claude runtime has no subagent bridge. The run aborts rather than registering a tool that could not dispatch.","triggerScenarios":"Thrown at packages/agent/src/claude-runtime.ts:98 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Strip subagent-runtime tools from definitions routed to the Claude runtime","Run these definitions on a harness that implements subagent dispatch","Flatten the subagent tool into a plain read/inline tool the Claude lane supports"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}