[BUG] API issue: `thinking` or `redacted_thinking` blocks in the latest assistant message cannot be modified. These blocks must remain as they were in the original response."
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Sometimes when I run out of context and claude code attempts to auto-compact I get an error like this:
⎿ Error: Error during compaction: Error: API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.3.content.91: thinking or
redacted_thinking blocks in the latest assistant message cannot be modified. These blocks must remain as they were in the original
response."},"request_id":"req_011CVkUHwyt9SbRZuxMRLEnV"}
I cannot manually compact or rewind, it's a blocking issue. I'm not doing anything on my side to the payloads nor do I have anything running on my machine that is doing anything to intercept or modify API calls.
What Should Happen?
Auto-compact should not throw blocking API errors, it should continue on.
Error Messages/Logs
⎿ Error: Error during compaction: Error: API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.3.content.91: `thinking` or
`redacted_thinking` blocks in the latest assistant message cannot be modified. These blocks must remain as they were in the original
response."},"request_id":"req_011CVkUHwyt9SbRZuxMRLEnV"}
Steps to Reproduce
This is an intermittent failure, I have no idea what causes it, but it's happened twice before auto-compact. It also won't allow manual context compaction nor rewinding to try and compact. If it helps, claude is helping me write lean code to formally prove a conjecture.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
Version: 2.0.55
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗