[BUG] API Error 400: Orphaned tool_use blocks cause conversation corruption after parallel tool calls

Resolved 💬 5 comments Opened Jan 26, 2026 by Giladon Closed Feb 28, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When parallel tool calls are interrupted or fail, the conversation history becomes corrupted with orphaned tool_use blocks that lack corresponding tool_result blocks. All subsequent API requests fail with a 400 error until a new conversation is started.

This commonly occurs when Claude makes multiple parallel tool calls (e.g., reading multiple files) and something interrupts them (cancellation, timeout, or error).

What Should Happen?

Claude Code should handle interrupted parallel tool calls gracefully by adding placeholder/error tool_result blocks for interrupted calls, or cleaning up orphaned tool_use blocks before sending to the API. The conversation should recover automatically without requiring a new session.

Error Messages/Logs

2026-01-26T17:24:58.662Z [ERROR] Error in non-streaming fallback: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.3: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_014puqxXpgwHqPky5cuYdXwV, toolu_01R12i8vLJUPDaHU3kcj3ghb, toolu_01XhWMfqVaSHCDsLcN1mhT9L. Each `tool_use` block must have a corresponding `tool_result` block in the next message."},"request_id":"req_011CXWNxstqccvAQsA7hL3XK"}

2026-01-26T17:25:12.402Z [ERROR] Error in non-streaming fallback: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.5: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01BUGVKH9ze1vHBbNGk2GQxp, toolu_01GXhRKi78uWgJ2vz4hFAyKo, toolu_01SHeQjPX3hZEL43sBrv1oAd. Each `tool_use` block must have a corresponding `tool_result` block in the next message."},"request_id":"req_011CXWNytnSnCk5Q4fEkqMnm"}

Steps to Reproduce

Open Claude Code in VSCode (version 2.1.19)
Start a conversation and make a request that triggers multiple parallel tool calls (e.g., "read these 3 files" or any complex search operation)
Have the operation interrupted - this can happen via:
User cancellation during execution
Timeout on one or more tools
An error occurring mid-execution (e.g., file too large)
Attempt any subsequent action in the same conversation
Error appears: "API Error: 400 due to tool use concurrency issues"
All further requests in this conversation fail with the same error

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No related to version, it suddenly happened, and even when I updated it happens.

Claude Code Version

Claude Code Version: 2.1.19

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

_No response_

View original on GitHub ↗

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