Skip to content

[BUG] anthropic tool_use blocks missing tool_result blocks - Complete system failure #190

Description

@drzraf

Describe the bug
tool_use blocks missing tool_result blocks - Complete system failure

To Reproduce
Steps (from the original bug report)

  • Start Roo agent in Debug mode (or any mode)
  • Issue a request requiring 4+ parallel tool calls (e.g., "search codebase for X and read files Y, Z,
  • Wait for tools to execute
  • Error occurs when agent attempts next API call

Frequency: ~100% reproducible with 4+ parallel tools

Simpler personal reproducer:

  • triggers Claude to use read_multiple_file tools against more than one image
  • API failure in a loop

(I strongly believe this is the same underlying root cause)

The system sends API requests with tool_use blocks but missing or incomplete tool_result blocks, violating Anthropic's API contract and causing immediate failure.

Expected behavior
All tool_use blocks should have corresponding tool_result blocks in the next user message per Anthropic API requirements.

Root Cause Analysis
Primary Diagnosis (80% confidence): Message history reconstruction bug

When rebuilding conversation history for the API request:

  1. Agent executes 4 tools in parallel ✅
  2. All 4 tool_use blocks recorded in assistant message ✅
  3. BUG: Tool results missing/incomplete when constructing next user message ❌
  4. Malformed API request sent ❌
  5. Anthropic API rejects request ❌

What version of zoo are you running
latest

Additional context
Original bug report: RooCodeInc/Roo-Code#11777
remote draft PR: RooCodeInc/Roo-Code#12183

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions