[BUG] `tool_use` ids were found without `tool_result` blocks after failed cancel

Resolved 💬 13 comments Opened Apr 9, 2025 by scottleibrand Closed May 8, 2025

Environment

  • Platform (select one):
  • [X] Google Vertex AI
  • Claude CLI version: 0.2.66 (Claude Code)

Bug Description

  ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.8: `tool_use` ids were found without

> /compact
  ⎿  Error: Error during compaction: Error: API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.8:
     `tool_use` ids were found without `tool_result` blocks immediately after: toolu_vrtx_015oxzdhxTvyks3Djx4FZE3h. Each `tool_use` block
     must have a corresponding `tool_result` block in the next message."}}

Steps to Reproduce

Not sure I'll be able to reproduce it. It happened after I hit Escape to cancel what it was doing after an auto-compaction, but it failed to properly cancel it. While the activity was still ongoing, I could submit prompts and hit enter, but it would immediately return:
⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.8: tool_use ids were found without
and continue running the previous activity.

I let it complete, then hit Escape to reject the proposed edit, and then tried to /compact, and got a more complete version of the same error, as show in the description section above.

Expected Behavior

When I hit escape, it cancels the ongoing activity.

View original on GitHub ↗

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