Skip to content

_fix_tool_message_ordering only runs with reasoning enabled, breaks Anthropic without it #1935

@habema

Description

@habema

The following error is triggered when using Anthropic models without reasoning enabled.

AnthropicException - messages.2.content.1: unexpected `tool_use_id` found in `tool_result` blocks

Root cause:
The _fix_tool_message_ordering() method is only called when preserve_thinking_blocks=True (i.e., when reasoning is enabled), but the bug it fixes affects all Anthropic models.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions