Skip to content

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

@scottleibrand

Description

@scottleibrand

Environment

  • Platform (select one):
    • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions