API Error: thinking blocks cannot be modified during Write operations
Resolved 💬 4 comments Opened Jan 26, 2026 by cjsimon2 Closed Feb 28, 2026
Description
Intermittent API error occurs during Write tool operations, even across new CLI terminal sessions.
Error Message
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.1.content.71: `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_011CXVnWn4RVUr9hksVHoruj"}
Environment
- Claude Code version: 2.1.19
- Platform: Windows 11 (win32)
- Model: claude-opus-4-5-20251101
Steps to Reproduce
- Start a conversation that involves writing files
- Use the Write tool to create/modify files
- Error occurs seemingly randomly during Write operations
Observed Behavior
- The Write tool output shows "Wrote 1 lines" even for multi-line files
- The file content is often successfully written despite the error
- Starting a new terminal session does not resolve the issue
- The error references
messages.1.content.71suggesting conversation history corruption
Expected Behavior
Write operations should complete without API errors about thinking block modification.
Additional Context
This appears to be a state management issue where thinking blocks in the conversation history are being modified between API calls, violating the API contract that thinking blocks must remain unchanged.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗