[BUG] API Error: 400 {"error":{"message":"Error code: 400 - {'code': 'invalid_request_error', 'message': 'messages.4: `tool_use` ids were found without `tool_result` blocks immediately after

Resolved 💬 1 comment Opened Sep 28, 2025 by Dream403 Closed Oct 2, 2025

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?

API error during use: 400 {"error":{"message":"Error code: 400 - {'code': 'invalid_request_error', 'message': 'messages.4:
tool_use ids No tool_result block was found immediately after the following location: toolu_01PhtXaGYuPQLCCemN1sqfSU.
Can only be cleared.

What Should Happen?

API error during use: 400 {"error":{"message":"Error code: 400 - {'code': 'invalid_request_error', 'message': 'messages.4:
tool_use ids No tool_result block was found immediately after the following location: toolu_01PhtXaGYuPQLCCemN1sqfSU.
Can only be cleared.

Error Messages/Logs

⎿ API Error: 400 {"error":{"message":"Error code: 400 - {'code': 'invalid_request_error', 'message': 'messages.4:
    `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01PhtXaGYuPQLCCemN1sqfSU. Each
    `tool_use` block must have a corresponding `tool_result` block in the next
    message.'}","type":"invalid_request_error"}}

Steps to Reproduce

<img width="1643" height="525" alt="Image" src="https://github.com/user-attachments/assets/7b361858-dbbb-4e3b-b097-b8ba46df9807" />

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

1.0.128

Claude Code Version

1.0.128

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

<img width="1643" height="525" alt="Image" src="https://github.com/user-attachments/assets/7ebb3e8b-ec1f-4233-a045-9e0cd841a3b2" />

<img width="677" height="69" alt="Image" src="https://github.com/user-attachments/assets/09b24cce-9b4b-4895-8aba-2b8c164d674b" />

<img width="1458" height="575" alt="Image" src="https://github.com/user-attachments/assets/1a471d4c-a77e-47d4-bf9f-dde52abc0b12" />

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗