JuliusBrussee/caveman · error · Error
cave_claude_tool_result_invalid
Error message
cave_claude_tool_result_invalid:${item.name} What it means
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.
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/agent/src/claude-runtime.ts:169 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of JuliusBrussee/caveman@766dce6b13 (2026-08-18).
Data as JSON: /api/errors/c6c6bf54a021df59.
Report an issue: GitHub.
Appendix: source
Thrown at packages/agent/src/claude-runtime.ts:169
throw new Error(`cave_claude_tool_schema_unsupported:${item.name}`);
}
const execute = createHarnessToolExecutor({
definition,
tool: item,
sandbox,
...(options.sandboxProfile === undefined ? {} : { sandboxProfile: options.sandboxProfile }),
...(options.engineBin === undefined ? {} : { engineBin: options.engineBin }),
});
const wireName = `mcp__caveman_agent__${item.name}`;
toolNames.add(wireName);
return claudeTool(
item.name,
item.description,
converted.shape,
async (args) => {
const value = await execute(args, controller.signal);
if (!isRecord(value) || !Array.isArray(value.content)) {
throw new Error(`cave_claude_tool_result_invalid:${item.name}`);
}
return value as { content: Array<{ type: "text"; text: string }> };
},
{ alwaysLoad: true },
);
});
const mcpServers: NonNullable<ClaudeSDKOptions["mcpServers"]> = {};
if (mcpTools.length > 0) {
mcpServers.caveman_agent = createSdkMcpServer({
name: "caveman_agent",
version: FRAMEWORK_VERSION,
tools: mcpTools,
alwaysLoad: true,
});
}
const sdkOptions: ClaudeSDKOptions = {
abortController: controller,
cwd: rootDir,View on GitHub (pinned to 766dce6b13)