Skip to content

Claude Opus 4.5 (latest) eventually fails: thinking block cannot be modified #13286

Description

@Jonathanm10

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_thinking blocks were modified.

Exact error:

messages.7.content.9: `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 appears to happen consistently after some conversation length/tool usage (not immediately on first turn).

Impact

  • Session becomes unrecoverable for that turn/model state
  • Prevents continued use of Opus 4.5 in longer real-world sessions

Steps to reproduce

  1. Configure OpenCode to use Anthropic Claude Opus 4.5 (latest)
  2. Start a normal coding session with multiple turns (including tool calls)
  3. Continue until context grows and OpenCode sends follow-up turns
  4. Observe Anthropic validation failure above

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:

... `thinking` or `redacted_thinking` blocks in the latest assistant message cannot be modified ...

Notes

Environment

  • Provider: Anthropic
  • Model: Claude Opus 4.5 (latest)
  • OS / terminal / OpenCode version: not yet collected from reporter

Activity

  1. github-actions commented on Feb 12, 2026

    @github-actions
    Contributor

    Thanks 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:

    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.

  2. Jonathanm10 commented on Feb 12, 2026

    @Jonathanm10
    Author

    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).

  3. shrimpwtf commented on Feb 16, 2026

    @shrimpwtf

    thinking or redacted_thinking blocks in the latest assistant message cannot be modified.

    getting very frequently

  4. gnadaban commented on Feb 20, 2026

    @gnadaban

    Anyone running into this, there are now 2 pending PRs fixing this issue, it's only a matter of time hopefully. :)

  5. tongsh6 commented on Feb 28, 2026

    @tongsh6

    I'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.

  6. pietdaniel commented on Feb 28, 2026

    @pietdaniel

    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-v1 with the exact model ID amazon-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
    
  7. paul4156 commented on Mar 9, 2026

    @paul4156

    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.

  8. assigned and unassigned on Apr 26, 2026
  9. rekram1-node commented on May 7, 2026

    @rekram1-node
    Collaborator

    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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions