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

Open
opened 2026-02-16 18:11:46 -05:00 by yindo · 3 comments
Owner

Originally created by @Jonathanm10 on GitHub (Feb 12, 2026).

Originally assigned to: @thdxr on GitHub.

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

  • Likely related to message reconstruction/compaction/replay logic for Anthropic thinking blocks.
  • Possibly related prior reports: #10970 and #8010 (similar thinking-block ordering/validation failures), but this report is the explicit "cannot be modified" variant on latest Opus 4.5.

Environment

  • Provider: Anthropic
  • Model: Claude Opus 4.5 (latest)
  • OS / terminal / OpenCode version: not yet collected from reporter
Originally created by @Jonathanm10 on GitHub (Feb 12, 2026). Originally assigned to: @thdxr on GitHub. ### 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: ```text 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: ```text ... `thinking` or `redacted_thinking` blocks in the latest assistant message cannot be modified ... ``` ### Notes - Likely related to message reconstruction/compaction/replay logic for Anthropic thinking blocks. - Possibly related prior reports: #10970 and #8010 (similar thinking-block ordering/validation failures), but this report is the explicit "cannot be modified" variant on latest Opus 4.5. ### Environment - Provider: Anthropic - Model: Claude Opus 4.5 (latest) - OS / terminal / OpenCode version: not yet collected from reporter
Author
Owner

@github-actions[bot] commented on GitHub (Feb 12, 2026):

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:

  • #10970: Claude Models Thinking block error
  • #8010: Expected thinking or redacted_thinking but found tool_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.

@github-actions[bot] commented on GitHub (Feb 12, 2026): 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: - #10970: Claude Models Thinking block error - #8010: Expected `thinking` or `redacted_thinking` but found `tool_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.
Author
Owner

@Jonathanm10 commented on GitHub (Feb 12, 2026):

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

@Jonathanm10 commented on GitHub (Feb 12, 2026): 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).
Author
Owner

@shrimpwtf commented on GitHub (Feb 16, 2026):

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

getting very frequently

@shrimpwtf commented on GitHub (Feb 16, 2026): `thinking` or `redacted_thinking` blocks in the latest assistant message cannot be modified. getting very frequently
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9153