Skip to content

Amazon Bedrock Opus 4.6 compaction failure #14332

Closed

Description

@inventumamet

Description

Got error

undefined: The model returned the following errors: messages.3.content.47: thinking or redacted_thinking blocks in the latest assistant message cannot be modified. These blocks must remain as they were in the original response.

Plugins

No response

OpenCode version

1.2.6

Steps to reproduce

  1. Use Claude Opus 4.6 from Amazon with thinking mode turned on using ctrl+t to select variant (i found that using the non-thinking variant avoids this issue)
  2. Use until token is over 170k
  3. Try to compact, and the error appears
    undefined: The model returned the following errors: messages.3.content.47: thinking or redacted_thinking blocks in the latest assistant message cannot be modified. These blocks must remain as they were in the original response.
  4. Compaction not able to proceed
  5. WORKAROUND: Switch to another model on bedrock say Minimax M2, compact works okay, then switch back to Opus 4.6 it will work

Screenshot and/or share link

No response

Operating System

macOS 26.3

Terminal

Zsh (vscode)

Activity

  1. github-actions commented on Feb 19, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    • Claude Opus 4.5 (latest) eventually fails: thinking block cannot be modified #13286: Same exact error — thinking or redacted_thinking blocks cannot be modified — reported for Claude Opus 4.5 with the same root cause (thinking block preservation during message reconstruction/compaction). The difference here is the model (Opus 4.6 via Amazon Bedrock) and the specific trigger (compaction at ~170k tokens), but the underlying bug appears to be the same.

    Please review #13286 and consider whether this is the same issue or a related variant specific to Bedrock/compaction flow.

  2. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Feb 19, 2026
  3. neshreve commented on Mar 2, 2026

    @neshreve

    Also experiencing this behavior on OpenCode 1.2.15, Claude Sonnet 4.6 via AWS Bedrock

  4. inventumamet commented on Mar 2, 2026

    @inventumamet
    Author

    I haven't had any issues with 1.2.15 so far with opus 4.6. I thought it had been fixed 😁

  5. bbartels commented on Apr 20, 2026

    @bbartels
    Contributor

    Running into this issue with 1.4.7

  6. removed
    bugSomething isn't working
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  7. rekram1-node commented on May 7, 2026

    @rekram1-node
    Contributor

    Is anyone still having this issue? if so can u send me a session: opencode export > session.json run this command NOT /export and send me json file, u can also dm it on X or discord, or email me

  8. IgnisDa commented on May 7, 2026

    @IgnisDa

    Hi @rekram1-node ! I have sent you the export on X.com. If you want I can also email it to you (i couldn't find your email ID, and the discord link in your github profile is invalid).

    I have observed the same issue in sonnet-4.6 on bedrock and opus so the export I sent to you was for sonnet. If needed, I can also send you an opus export since the issue is very easy to reproduce.

  9. J-Light commented on May 8, 2026

    @J-Light

    Can confirm this issue is repeatable when variant is set to non-default of high.

  10. bbartels commented on May 12, 2026

    @bbartels
    Contributor

    @rekram1-node Would you mind taking another look? :) Seems like @IgnisDa has sent you an export

  11. cheeseandcereal commented on Jun 10, 2026

    @cheeseandcereal

    I thought #29786 would solve this issue, but I'm still experiencing this issue on 1.17.0

  12. jessevdp commented on Jun 11, 2026

    @jessevdp
    Contributor

    Probably maybe related: when I use compaction via bedrock I get a bunch of "Connection reset by server" errors.

    I'm not using AWS directly, I'm using the bedrock compatible proxy/passthrough endpoint of LiteLLM.

    But it feels at least related.

    This happens for Opus 4.6 and 4.8 for me (those are the ones I've tested -> it seems to have more to do with the provider than the model anyway..).

    I also tried to "unset" the thinking mode. But that gives the same errors.


    Using OpenCode 1.17.3 right now. But I've seen this happen on previous versions too.

  13. mayshwartz2 commented on Jul 16, 2026

    @mayshwartz2

    hey @rekram1-node,
    we are still experiencing it with 1.17.13 and sonnet 4.6 with bedrock - any updates on this?

  14. nabilfreeman commented on Jul 29, 2026

    @nabilfreeman
    Contributor

    Same problem in Sonnet, Opus and Fable 5

  15. dreamorosi commented on Aug 6, 2026

    @dreamorosi

    Also experiencing this on 1.18.14 with Bedrock Sonnet 5 - unfortunately I can't share the session export

  16. rekram1-node commented on Aug 7, 2026

    @rekram1-node
    Contributor

    Okay looking into this so sorry lost track of this issue

  17. rekram1-node commented on Aug 7, 2026

    @rekram1-node
    Contributor

    This may have been fixed in 1.18.15 actually

  18. opencode-agent commented on Aug 7, 2026

    @opencode-agent
    Contributor

    This was addressed in the latest release by changing compaction requests so the conversation history is serialized into a single user message. This prevents preserved assistant thinking / redacted_thinking blocks from being modified or replayed as part of the compaction request.

    We also verified the post-compaction path with Amazon Bedrock Claude Opus 4.6 and thinking enabled, including retained recent turns, a tail beginning at an assistant-message boundary, and multiple messages sent after compaction. We could not reproduce the failure on the latest release.

    Closing as resolved. If you continue to hit this on the latest version, please let us know with updated reproduction details and we can reopen the issue.

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