Skip to content

OpenAI reasoning block causes 400 error after model switch from Anthropic #1540

@drkraft

Description

@drkraft

Bug Description

When switching models mid-session from Anthropic (Claude) to OpenAI (GPT-5.2-codex), the session transcript becomes corrupted and all subsequent API calls fail with:

400 Item 'rs_XXXX' of type 'reasoning' was provided without its required following item.

Steps to Reproduce

  1. Start a session with an Anthropic model (e.g., claude-sonnet-4-5)
  2. Have some conversation with thinking/reasoning enabled
  3. Switch to an OpenAI model mid-session: /model gpt-5.2-codex
  4. The first response from OpenAI generates a thinkingSignature in the transcript containing OpenAI's reasoning format:
    "thinkingSignature": "{\"id\":\"rs_XXXX\",\"type\":\"reasoning\",\"encrypted_content\":\"...\"}"
  5. Any subsequent message fails with the 400 error above

Root Cause

The OpenAI Responses API requires that a reasoning block (type: "reasoning") be followed by its corresponding content item. When Clawdbot re-submits the conversation history to OpenAI, the orphaned reasoning ID in thinkingSignature causes the API to reject the request.

Expected Behavior

Model switching should work seamlessly. Options:

  • Strip/convert provider-specific reasoning metadata when switching providers
  • Store reasoning in a provider-agnostic format
  • Clear reasoning blocks from history on provider switch

Workaround

Manual fix: edit the session transcript to remove the thinkingSignature field and delete error lines. Or use /reset (loses history).

Environment

  • Clawdbot version: 2026.1.16-2
  • Channel: Discord
  • Models involved: anthropic/claude-sonnet-4-5openai/gpt-5.2-codex
  • Thinking/reasoning: was enabled

Transcript excerpt

// Line causing the issue (GPT response with OpenAI reasoning format):
{"message":{"content":[{"type":"thinking","thinkingSignature":"{\"id\":\"rs_07274b...\",\"type\":\"reasoning\",...}"}]}}

// Subsequent errors:
{"stopReason":"error","errorMessage":"400 Item 'rs_07274b...' of type 'reasoning' was provided without its required following item."}

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