[BUG] Thinking blocks modification error persists in v2.1.20 (post-Jan 25 fix)

Resolved 💬 5 comments Opened Jan 27, 2026 by corylanou Closed Mar 14, 2026

Preflight Checklist

  • [x] I have searched existing issues and found related issues
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

Related Issues

This appears related to #10199 (main tracking issue), #20711, and #20954. Noting that #20711 had a comment on Jan 25 stating "This issue appears to be fixed now!" - however this bug occurred on Jan 27, suggesting either a regression or incomplete fix.

What's Wrong?

The API returns a 400 error indicating thinking blocks cannot be modified:

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.7.content.34: thinking or redacted_thinking blocks in the latest assistant message cannot be modified. These blocks must remain as they were in the original response."},"request_id":"[redacted]"}

Error Details from Debug Log

  1. Error occurs in "non-streaming fallback" mode
  2. The error path shows: messages.7.content.34 indicating:
  • 7 messages in conversation history
  • 34th content block contains the problematic thinking block
  1. There's also a preceding error: output_config: Extra inputs are not permitted which may be related
  2. Error repeats on retry attempts

Stack trace:

Error in non-streaming fallback: 400 {...}
    at generate (/$bunfs/root/claude:145:37631)
    at makeRequest (/$bunfs/root/claude:162:5435)
    at processTicksAndRejections (native:7:39)

Steps to Reproduce

Unable to provide exact reproduction steps. The error occurred during a normal conversation session. Based on debug logs:

  1. Normal session with extended thinking enabled (Opus 4.5 model)
  2. Multiple tool calls and file operations in conversation
  3. Non-streaming fallback triggered
  4. API rejected request due to thinking block modification

Expected Behavior

The conversation should continue without API errors.

Actual Behavior

API returns 400 error, session becomes unrecoverable.

Environment

  • Claude Code Version: 2.1.20
  • Platform: macOS (Darwin 25.1.0)
  • Model: claude-opus-4-5-20251101 (Opus 4.5)
  • Date: 2026-01-27

Additional Context

The debug log shows this pattern:

  1. output_config: Extra inputs are not permitted error occurs first
  2. Then thinking blocks cannot be modified error follows
  3. Both errors occur in "non-streaming fallback" path

This may indicate that when the primary streaming request fails and falls back to non-streaming, something in the request construction modifies thinking blocks improperly.

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗