Skip to content

Anthropic 400: tool_use ids found without tool_result blocks (messagesToAnthropicFormat) #620

Closed

Description

@BuomEm

Client or integration

Codex App

Area

Provider adapter

Summary

Anthropic 400: tool_use ids were found without tool_result blocks immediately after

When using an Anthropic (Claude) backend, requests fail with:
messages.4: tool_use ids were found without tool_result blocks immediately after: call_4d252114da304363a52244af

Root cause in messagesToAnthropicFormat (line ~424): when an assistant message's text+thinking content is filtered to empty, if (content.length === 0) break skips the entire toolResult processing block. Tool_use blocks are collected but never paired with tool_result blocks — no synthetic [missing tool_result] is created.

Reproduction

  1. ocx start
  2. Configure Anthropic backend (claude-opus-4-6-thinking) via google-antigravity
  3. Use Codex for a session with multiple tool calls until conversation history is large
  4. Observe: messages.4: tool_use ids were found without tool_result blocks

Version

2.7.42

Operating system

Windows 11 24H2

Provider and model

google-antigravity / claude-opus-4-6-thinking

Logs or error output

Provider error 400: Antigravity invalid request: {"type":"error","error":{"type":"invalid_request_error","message":"messages.4: `tool_use` ids were found without `tool_result` blocks immediately after: call_4d252114da304363a52244af. Each `tool_use` block must have a corresponding `tool_result` block in the next message."}}

Screenshots and supporting files

No response

Redacted configuration

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

  1. github-actions commented on Jul 28, 2026

    @github-actions
    Contributor

    Automated translation bookkeeping — detected language: English.

  2. self-assigned this
    on Jul 28, 2026
  3. added a commit that references this issue on Jul 29, 2026
    c7e48fb
  4. added a commit that references this issue on Jul 29, 2026
    52cc29b
  5. added a commit that references this issue on Sep 17, 2026
    62ec254
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions