[Bug] Anthropic API Error: thinking blocks corrupted during context compaction with extended thinking enabled

Resolved 💬 2 comments Opened May 28, 2026 by nadertaha06 Closed Jun 1, 2026

Bug Description
Title: 400 "thinking blocks cannot be modified" mid-conversation with no user-side trigger Description: Recurring 400 error mid-conversation with extended thinking enabled: API Error: 400 messages.3.content.1: thinking or redacted_thinking blocks in the latest assistant message cannot be modified. These blocks must remain as they were in the original response. First turn succeeds; the error appears on a later turn when a prior assistant message containing a thinking block is replayed. messages.3.content.1 points to a thinking block that was altered before being re-sent. Important: This happens during normal use with no user-side trigger — I did not interrupt a streaming response, did not queue/type a message while the assistant was responding, did not switch models, and did not use /rewind or edit any previous message. This points to internal history handling (likely context compaction or message replay) corrupting the thinking block rather than a user action. Environment: - Claude Code: 2.1.154 (native install, latest available) - Platform: macOS (Darwin 25.5.0), arm64 - Shell: zsh - Model: Opus 4.8 (1M context), effortLevel: high - Hooks: one PreToolUse hook (matcher Bash) → rtk hook claude (ruled out — Bash-only, never touches messages) Workaround: /clear restores the session.

Environment Info

  • Platform: darwin
  • Terminal: Apple_Terminal
  • Version: 2.1.154
  • Feedback ID: 835f774d-11b2-4799-a94d-671158993161

Errors

[]

View original on GitHub ↗

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