Skip to content

[BUG] Claude requests fail with HTTP 400 when multiple tool calls run concurrently (tool message order mismatch) #11804

@little2b

Description

@little2b

Problem (one or two sentences)

When using a Claude model (Anthropic Messages API) in Roo Code, requests intermittently fail with HTTP 400 if the assistant triggers multiple tool calls concurrently. This appears to be caused by tool result messages being appended in completion order rather than the original tool_use order, which violates the API’s expected message/blocks ordering.

Image

Context (who is affected and when)

Who is affected: Anyone using Roo Code with Claude models (Anthropic Messages API) and enabling parallel/concurrent tool execution.

Reproduction steps

Configure Roo Code to use a Claude model via the Anthropic Messages API (any Claude variant is fine).

Ensure tool calling is enabled and the tool runner executes tools concurrently/in parallel (default in many setups).

Use a prompt that reliably triggers multiple tool calls in a single assistant turn, e.g.:

“Search the web for X and Y, then summarize both sources.”

“Run tool A and tool B at the same time, then compare results.”

Run the agent multiple times (or increase likelihood by making one tool slower—e.g., add an artificial delay to one tool implementation).

Observe that when tools finish in a different order than they were requested, Roo Code sends tool_result blocks back out of the original tool_use order.

The Anthropic API then rejects the request with HTTP 400 (conversation invalid / tool results ordering mismatch), and the run fails.

Expected result

Tool results should be sent back to Claude in the same order as the model’s tool_use blocks (matched by tool_use_id), so the request succeeds without HTTP 400.

Actual result

Tool results are sometimes returned out of the original tool_use order during concurrent execution, causing Claude to respond with HTTP 400 and the run to fail.

Variations tried (optional)

No response

App Version

3.50.5 (961d340)

API Provider (optional)

Anthropic

Model Used (optional)

No response

Roo Code Task Links (optional)

No response

Relevant logs or errors (optional)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions