Skip to content

Missing Tool Result Block for Unresolved Tool Use in Claude Code Execution #3331

@aero29

Description

@aero29

Bug Description
Suddenly right in middle of an execution got this message : Error: Error during compaction: Error: 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_01EB9C2LF56Stoyr4epVsiVb. Each tool_use block
must have a corresponding tool_result block in the next message."}}. It was working well till now. Tried claude --resume in another terminal session. Same result

Environment Info

  • Platform: darwin
  • Terminal: Apple_Terminal
  • Version: 1.0.48
  • Feedback ID: 2b4e6137-53f8-406b-b58a-5f0edc42673c

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:892:11)\n    at execSync (node:child_process:964:15)\n    at $D (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:704:4293)\n    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:9350\n    at Q (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:526:14406)\n    at dC (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:8496)\n    at mC (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:7361)\n    at wB (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:11970)","timestamp":"2025-07-11T10:21:44.707Z"},{"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_01EB9C2LF56Stoyr4epVsiVb. Each `tool_use` block must have a corresponding `tool_result` block in the next message.\"}}\n    at D6.generate (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1307:12578)\n    at dq.makeStatusError (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1324:2100)\n    at dq.makeRequest (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1324:5311)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async hA1.showErrors (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1695:23178)\n    at async hA1 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1695:12720)\n    at async $O2 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1695:23029)\n    at async file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1695:18138\n    at async R0A (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1695:5121)\n    at async zc (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1695:18108)","timestamp":"2025-07-11T10:22:30.438Z"},{"error":"Error: 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_01EB9C2LF56Stoyr4epVsiVb. Each `tool_use` block must have a corresponding `tool_result` block in the next message.\"}}\n    at Mz1 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1930:1330)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async Object.call (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2042:809)\n    at async xf6 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2571:58)\n    at async _p (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2567:24070)\n    at async file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2572:5013","timestamp":"2025-07-11T10:22:30.456Z"},{"error":"Error: Error during compaction: Error: 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_01EB9C2LF56Stoyr4epVsiVb. Each `tool_use` block must have a corresponding `tool_result` block in the next message.\"}}\n    at Object.call (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2043:229)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async xf6 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2571:58)\n    at async _p (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2567:24070)\n    at async file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2572:5013","timestamp":"2025-07-11T10:22:30.457Z"}]

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:apiarea:corebugSomething isn't workinghas reproHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOS

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions