claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Missing Tool Result Block for Tool Use

Open SamuelSchlesinger opened this issue 10 months ago • 5 comments

Bug Description ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.14: tool_use ids were found without tool_result blocks immediately after: toolu_01MA7jwznA17Zp7yNX7YdnxD. Each tool_use block must have a corresponding tool_result block in the next message."}}

Environment Info

  • Platform: macos
  • Terminal: alacritty
  • Version: 1.0.21
  • Feedback ID: ce4e1223-ddcb-4035-bd3a-0b2d0d78d75e

Errors

[{"error":"Error: Command failed: security find-generic-password -a $USER -w -s \"Claude Code\"\nsecurity: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.\n\n    at genericNodeError (node:internal/errors:983:15)\n    at wrappedFn (node:internal/errors:537:14)\n    at checkExecSyncError (node:child_process:882:11)\n    at execSync (node:child_process:954:15)\n    at HZ (file:///Users/samuelschlesinger/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:659:3921)\n    at file:///Users/samuelschlesinger/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:582:11795\n    at Q (file:///Users/samuelschlesinger/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:526:17190)\n    at oJ (file:///Users/samuelschlesinger/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:582:10941)\n    at YS (file:///Users/samuelschlesinger/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:582:10022)\n    at R6 (file:///Users/samuelschlesinger/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:582:14134)","timestamp":"2025-06-12T02:41:52.281Z"},{"error":"Error: Domain web.archive.org is not allowed to be fetched\n    at wR2 (file:///Users/samuelschlesinger/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1915:1610)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async Object.call (file:///Users/samuelschlesinger/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1915:4919)\n    at async ZY5 (file:///Users/samuelschlesinger/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1886:20690)\n    at async bK1 (file:///Users/samuelschlesinger/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1886:19247)\n    at async jK1 (file:///Users/samuelschlesinger/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1880:775)\n    at async GY5 (file:///Users/samuelschlesinger/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1886:18391)\n    at async BY5 (file:///Users/samuelschlesinger/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1886:17876)\n    at async kO (file:///Users/samuelschlesinger/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1886:16919)\n    at async kO (file:///Users/samuelschlesinger/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1886:17755)","timestamp":"2025-06-12T02:45:41.037Z"},{"error":"Error: Domain web.archive.org is not allowed to be fetched\n    at wR2 (file:///Users/samuelschlesinger/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1915:1610)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async Object.call (file:///Users/samuelschlesinger/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1915:4919)\n    at async ZY5 (file:///Users/samuelschlesinger/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1886:20690)\n    at async bK1 (file:///Users/samuelschlesinger/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1886:19247)\n    at async jK1 (file:///Users/samuelschlesinger/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1880:775)\n    at async GY5 (file:///Users/samuelschlesinger/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1886:18391)\n    at async BY5 (file:///Users/samuelschlesinger/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1886:17876)\n    at async kO (file:///Users/samuelschlesinger/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1886:16919)\n    at async kO (file:///Users/samuelschlesinger/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1886:17755)","timestamp":"2025-06-12T02:45:41.039Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.14: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01MA7jwznA17Zp7yNX7YdnxD. Each `tool_use` block must have a corresponding `tool_result` block in the next message.\"}}\n    at g6.generate (file:///Users/samuelschlesinger/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1327:12578)\n    at qw.makeStatusError (file:///Users/samuelschlesinger/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1342:2082)\n    at qw.makeRequest (file:///Users/samuelschlesinger/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1342:5257)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async D11.showErrors (file:///Users/samuelschlesinger/.claude/local/node_modules/@anthropic-ai/cla

Note: Error logs were truncated.

SamuelSchlesinger avatar Jun 12 '25 02:06 SamuelSchlesinger

Same issue here - I interrupted Claude during a Web Search, so that may be what caused it

Keno avatar Jun 12 '25 23:06 Keno

Yep, this continually happens with the Web Search tool in particular.

SamuelSchlesinger avatar Jun 13 '25 17:06 SamuelSchlesinger

It's happened to me a bunch of times.

SamuelSchlesinger avatar Jun 13 '25 17:06 SamuelSchlesinger

same error but in think mode

Kanezal avatar Jun 14 '25 21:06 Kanezal

I'd really appreciate the option to either get rid of the tool call that caused this or to add an arbitrary response I write myself, or to retry the tool call. Anything but bricking the session

SamuelSchlesinger avatar Jun 14 '25 23:06 SamuelSchlesinger

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Sep 26 '25 14:09 github-actions[bot]