{"record":{"id":"c6c6bf54a021df59","repo":"JuliusBrussee/caveman","slug":"cave-claude-tool-result-invalid-item-name","errorCode":null,"errorMessage":"cave_claude_tool_result_invalid:${item.name}","messagePattern":"cave_claude_tool_result_invalid:(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/agent/src/claude-runtime.ts","lineNumber":169,"sourceCode":"        throw new Error(`cave_claude_tool_schema_unsupported:${item.name}`);\n      }\n      const execute = createHarnessToolExecutor({\n        definition,\n        tool: item,\n        sandbox,\n        ...(options.sandboxProfile === undefined ? {} : { sandboxProfile: options.sandboxProfile }),\n        ...(options.engineBin === undefined ? {} : { engineBin: options.engineBin }),\n      });\n      const wireName = `mcp__caveman_agent__${item.name}`;\n      toolNames.add(wireName);\n      return claudeTool(\n        item.name,\n        item.description,\n        converted.shape,\n        async (args) => {\n          const value = await execute(args, controller.signal);\n          if (!isRecord(value) || !Array.isArray(value.content)) {\n            throw new Error(`cave_claude_tool_result_invalid:${item.name}`);\n          }\n          return value as { content: Array<{ type: \"text\"; text: string }> };\n        },\n        { alwaysLoad: true },\n      );\n    });\n    const mcpServers: NonNullable<ClaudeSDKOptions[\"mcpServers\"]> = {};\n    if (mcpTools.length > 0) {\n      mcpServers.caveman_agent = createSdkMcpServer({\n        name: \"caveman_agent\",\n        version: FRAMEWORK_VERSION,\n        tools: mcpTools,\n        alwaysLoad: true,\n      });\n    }\n    const sdkOptions: ClaudeSDKOptions = {\n      abortController: controller,\n      cwd: rootDir,","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/packages/agent/src/claude-runtime.ts#L151-L187","documentation":"Runtime guard in the Claude tool executor: a tool named in the message returned a result that failed validation (wrong shape/type for an inline read tool), so the result cannot be fed back to the model.","triggerScenarios":"Thrown at packages/agent/src/claude-runtime.ts:169 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the named tool's execute to return the expected inline result shape","Wrap tool results in a conforming envelope before returning","Add a unit test for the named tool's return value"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"766dce6b1394ebb56a3090748d5a0240a5aefb36","analyzedAt":"2026-08-18T03:14:35.516Z","contentChangedAt":"2026-08-18T03:14:35.516Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}