API Error 400: tool_result block missing corresponding tool_use block

Resolved 💬 3 comments Opened Jan 21, 2026 by elias-ba Closed Jan 25, 2026

Description

Getting an API 400 error during a conversation. The error indicates a tool_result block references a tool_use_id that doesn't exist in the previous assistant message.

Error Message

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.0.content.0: unexpected `tool_use_id` found in `tool_result` blocks: toolu_01S86xDhQTUXjkRzpUxVqEmz. Each `tool_result` block must have a corresponding `tool_use` block in the previous message."},"request_id":"req_011CXLZi7G5zTT8n9RcagG1G"}

Context

  • The error occurred during a conversation where I asked Claude to read files from another repository
  • This appears to be a conversation state management issue where tool_use/tool_result pairs got out of sync, possibly during context summarization or truncation

Expected Behavior

The conversation should maintain proper pairing of tool_use and tool_result blocks, even after summarization or context management operations.

Workaround

Starting a fresh conversation with /clear resolves the issue temporarily.

View original on GitHub ↗

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