Skip to content

[Bug]: cross-provider switch from MiniMax to Anthropic fails with Invalid signature in thinking block; the "stripped all thinking blocks, retrying" path does not actually remove the block. #24401

@drpuri

Description

@drpuri

Bug Description

Summary

Switching models from a MiniMax model to claude-opus-4-7 (Anthropic) causes every subsequent turn in the existing conversation to fail with Invalid signature in thinking block. The strip-and-retry fallback logs that it stripped the offending blocks, but the retry fails at the same content index with the identical error, so the strip is not actually mutating the payload that gets re-sent.

Log output

✓ Model switched: claude-opus-4-7
    Provider: Anthropic
    Context: 1,000,000 tokens
    Max output: 128,000 tokens

⚠️  Thinking block signature invalid — stripped all thinking blocks, retrying...
⚠️  API call failed (attempt 1/3): BadRequestError [HTTP 400]
   Provider: anthropic  Model: claude-opus-4-7
   Endpoint: https://api.anthropic.com
   Error: HTTP 400: messages.1.content.7: Invalid `signature` in `thinking` block
   Details: {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'messages.1.content.7: Invalid `signature` in `thinking` block'}, 'request_id': 'req_011CaxpMs5YJTMSpYFCX9d7k'}
⚠️  API call failed (attempt 2/3): ... request_id: req_011CaxpN4QRd8dCmChPskBoq
⚠️  API call failed (attempt 3/3): ... request_id: req_011CaxpNSWx6PQhZ9UQGQUdf
⚠️ Max retries (3) exhausted — trying fallback...
❌ API failed after 3 retries — HTTP 400: messages.1.content.7: Invalid `signature` in `thinking` block

Workaround

/new (or /reset) clears the offending blocks and the new provider works fine on a fresh conversation. /compress may also work but I have not verified.

Anthropic request IDs (for server-side correlation)

  • req_011CaxpMs5YJTMSpYFCX9d7k
  • req_011CaxpN4QRd8dCmChPskBoq
  • req_011CaxpNSWx6PQhZ9UQGQUdf

Steps to Reproduce

Reproduction

  1. Start a conversation using a MiniMax model that emits reasoning/thinking content.
  2. Have at least one assistant turn so reasoning content is stored in history.
  3. Run /model anthropic:claude-opus-4-7 (model switch reports success).
  4. Send any user message.
  5. Every retry attempt fails; the conversation is unusable until /new or /reset.

Expected Behavior

Expected behavior

Either (a) cross-provider model switches should strip any thinking/reasoning blocks that did not originate from the new target provider before the first request, or (b) when the API returns Invalid signature in thinking block, the strip-and-retry path should actually remove the block from the payload used by the retry.

Actual Behavior

Actual behavior

The error recurs identically across all 3 retries, all pointing at the same content index, suggesting the retry is rebuilding the request body from the unstripped history rather than from a stripped copy.

Affected Component

Configuration (config.yaml, .env, hermes setup)

Messaging Platform (if gateway-related)

No response

Debug Report

Debug report uploaded:
  Report       https://paste.rs/gbWiP
  agent.log    https://paste.rs/BKf6g
  gateway.log  https://paste.rs/nTCF9

Operating System

24.04.1-Ubuntu SMP

Python Version

Python: 3.11.15

Hermes Version

Hermes Agent v0.13.0 (2026.5.7)

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

No response

Proposed Fix (optional)

No response

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High — major feature broken, no workaroundcomp/agentCore agent loop, run_agent.py, prompt builderprovider/anthropicAnthropic native Messages APIprovider/minimaxMiniMax (Anthropic transport)sweeper:implemented-on-mainSweeper: behavior already present on current maintype/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