Issue Title: Tool Result Block Validation Error in API Request This title captures the core technical issue of an unexpected tool use ID in the tool result block, which is causing a 400 API error, and is concise enough to quickly communicate the problem t

Resolved 💬 2 comments Opened Jun 8, 2025 by adamhelfgott Closed Jun 8, 2025

Bug Description
In another session I have been heavy in, on every prompt i put in i get back  API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.2.content.0: unexpected tool_use_id found in tool_result blocks:
toolu_01SXdn1juy4vAH8KU2kp6Wod. Each tool_result block must have a corresponding tool_use block in the previous message."}}

and it is stuck.

Environment Info

  • Platform: macos
  • Terminal: Apple_Terminal
  • Version: 1.0.17
  • Feedback ID: cf6f82dd-b7cb-4c85-9c78-9344fa4c2439

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 YZ (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:654:3921)\n    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:582:11794\n    at Q (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:526:17190)\n    at cJ (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:582:10940)\n    at aP (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:582:10021)\n    at a6 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:582:14133)","timestamp":"2025-06-08T00:14:22.289Z"}]

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗