Claude Opus 4.5 (latest) eventually fails: thinking block cannot be modified #13286
Description
Activity
github-actions commented
on Feb 12, 2026 on Feb 12, 2026 – with GitHub ActionsContributorMore actionsThanks for the detailed report! This appears to be related to how thinking blocks are handled during message reconstruction/compaction with Anthropic's Opus 4.5 model.
This is related to similar thinking block issues with Claude models:
- Claude Models Thinking block error #10970: Claude Models Thinking block error
- Expected
thinkingorredacted_thinkingbut foundtool_use#8010: Expectedthinkingorredacted_thinkingbut foundtool_use
The specific "cannot be modified" validation error suggests this is happening during message replay/reconstruction when OpenCode resends previous assistant messages. This is distinct from the other thinking block ordering issues, but the root cause may be related to how thinking blocks are being preserved and replayed in conversation history.
Adding reporter environment details:
- OpenCode version:
1.1.60 - OS:
macOS 26.2 (25C56) - Provider/auth path:
Anthropic OAuth subscription(direct Anthropic account auth)
This is reproducible in real usage over longer multi-turn sessions with Claude Opus 4.5 (latest).
- OpenCode version:
thinkingorredacted_thinkingblocks in the latest assistant message cannot be modified.getting very frequently
Reacted by Sebastian Rojo, Mochamad Revanza Kurniawan, Scott Anderson, William Rory Kronmiller, Dan Piet, ilyes, Akash and MuratReacted by Sebastian RojoAnyone running into this, there are now 2 pending PRs fixing this issue, it's only a matter of time hopefully. :)
Reacted by Dan PietI'm also experiencing this same issue.
Error message:
messages.5.content.51: `thinking` or `redacted_thinking` blocks in the latest assistant message cannot be modified. These blocks must remain as they were in the original response.This occurs during normal usage with extended thinking enabled. The conversation becomes unrecoverable once this error appears.
Environment:
- OS: Windows 11
- Model: Claude Opus 4.6 (via Anthropic)
+1 for a fix — this seems to be a persistent issue across multiple Claude model versions and is a significant blocker for longer sessions.
Same Experience, this happens when I get to ~120k tokens and try to run a compaction.
undefined: The model returned the following errors: messages.1.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.
Current model information
Session ID: ses_35b0c2b0bffeAhmbLv3c6TYj3J
Created: 2/28/2026, 10:52:49 AM
Updated: 2/28/2026, 10:53:20 AM
User
list your current model
Assistant (Build · anthropic.claude-opus-4-6-v1 · 5.2s)
Thinking:
The user is asking about my current model. I already have this information from the system prompt - I'm powered by
anthropic.claude-opus-4-6-v1with the exact model IDamazon-bedrock/anthropic.claude-opus-4-6-v1.My current model is:
- Model name:
anthropic.claude-opus-4-6-v1 - Exact model ID:
amazon-bedrock/anthropic.claude-opus-4-6-v1
User
list the current machine specification you are running on
Assistant (Build · anthropic.claude-opus-4-6-v1 · 7.1s)
Based on the environment information available to me, here's what I know:
- Platform: macOS (
darwin)
$ opencode --version 2>/dev/null || opencode version 2>/dev/null || which opencode 2>/dev/null 1.2.10- Model name:
Hitting this consistently with Claude Sonnet 4.6 + high thinking budget. Once thinking blocks accumulate in history, compaction fails and the session is dead. The only escape is starting a new session.
A configurable compaction threshold (e.g. trigger at 50%) would help a lot — even with some context loss, getting a working session at 50% is far better than a broken one at 85%. Related: #11314.
Believe this was fixed if people continue having it just send me a session where u encountered it:
opencode export > session.json(this is not /export this is a shell command to run)
Description
When using Claude Opus 4.5 (latest) from Anthropic in OpenCode, conversations eventually fail with a validation error indicating that previously returned
thinking/redacted_thinkingblocks were modified.Exact error:
This appears to happen consistently after some conversation length/tool usage (not immediately on first turn).
Impact
Steps to reproduce
Expected behavior
OpenCode should preserve any previously returned thinking blocks exactly as required by Anthropic and continue the session without validation errors.
Actual behavior
Request eventually fails with:
Notes
thinkingorredacted_thinkingbut foundtool_use#8010 (similar thinking-block ordering/validation failures), but this report is the explicit "cannot be modified" variant on latest Opus 4.5.Environment