Skip to content

unexpected tool_use_id found in tool_result blocks #1644

@aheritier

Description

@aheritier

Describe the bug

Since few hours my Anthropic models are rejecting my requests with:

all models failed: error receiving from stream: POST "https://api.anthropic.com/v1/messages": 400 Bad Request (Request-ID: req_011CXwUGAoEeBVooyRv5365i)
{"type":"error","error":{"type":"invalid_request_error","message":"messages.298.content.1: unexpected `tool_use_id` found in `tool_result` blocks:
toolu_01VaSNuJZRTJH227epge8S24. Each `tool_result` block must have a corresponding `tool_use` block in the previous message."},"request_id":"req_011CXwUGAoEeBVooyRv5365i"}

Version affected

cagent version v1.20.6
Commit: Homebrew

How To Reproduce

Not sure. My agents definition didn't change when the problem started to occur. I can share a team definition if useful.

Expectation

No error, or a better management of the error, right now cagent is not working anymore.

Screenshots

N/A

OS and Terminal type

macOS + Ghostty

Additional context

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions