{"record":{"id":"60d550718da825ad","repo":"JuliusBrussee/caveman","slug":"cave-tool-result-limit","errorCode":null,"errorMessage":"cave_tool_result_limit","messagePattern":"cave_tool_result_limit","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/agent/src/runtime.ts","lineNumber":3747,"sourceCode":"      // The worker path is bounded by killing its process; the IN-PROCESS\n      // (host/fixture) path is a closure this process cannot preempt, so a\n      // closure that ignores `combined` would hang the run forever. Race it\n      // against a hard deadline so the run stops waiting at timeoutMs with\n      // cave_tool_timeout (the closure keeps running in the background — JS\n      // cannot preempt it — but it no longer blocks the run).\n      const value = sandboxExecute\n        ? await sandboxExecute(params, combined)\n        : await raceToolTimeout(\n          Promise.resolve(definition.execute(params, combined)),\n          definition.timeoutMs,\n        );\n      const text = typeof value === \"string\" ? value : JSON.stringify(value);\n      const raw = new TextEncoder().encode(text ?? \"null\");\n      const maxInlineBytes = definition.artifact === undefined\n        ? 32_768\n        : definition.artifact.maxInlineTokens * 4;\n      if (deferLockedToolResult) {\n        if (raw.byteLength > 16 * 1024 * 1024) throw new Error(\"cave_tool_result_limit\");\n        return {\n          content: [{ type: \"text\", text: text ?? \"null\" }],\n          details: { effect: definition.effect, resultPolicy: definition.result, lockedRoutePending: true },\n        };\n      }\n      if (definition.result === \"inline\") {\n        if (raw.byteLength > maxInlineBytes) throw new Error(\"cave_tool_result_inline_limit\");\n        return {\n          content: [{ type: \"text\", text: text ?? \"null\" }],\n          details: { effect: definition.effect, resultPolicy: definition.result },\n        };\n      }\n      const mustOffload = definition.result === \"page\" ||\n        definition.result === \"compress\" ||\n        definition.result === \"exact_ccr\" ||\n        raw.byteLength > maxInlineBytes;\n      if (!mustOffload) {\n        return {","sourceCodeStart":3729,"sourceCodeEnd":3765,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/packages/agent/src/runtime.ts#L3729-L3765","documentation":"Error \"cave_tool_result_limit\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at packages/agent/src/runtime.ts:3747 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The tool result exceeds the configured byte limit; shrink the result or raise the limit."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}