[BUG] API Error 400: thinking block missing in multi-turn conversations with extended thinking enabled
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?
When using Claude Code CLI in a multi-turn conversation with extended thinking enabled, after several exchanges the following error appears and the session becomes unusable:
API Error: 400 messages.1.content.0.type: Expected thinking or redacted_thinking, but found text. When thinking is enabled, a final assistant message must start with a thinking block (preceding the lastmost set of tool_use and tool_result blocks). We recommend you include thinking blocks from previous turns. To avoid this requirement, disable thinking.
The only workaround is to disable extended thinking entirely, which degrades response quality.
What Should Happen?
Claude Code should preserve the thinking blocks in the conversation history when making subsequent API calls, so that multi-turn conversations with extended thinking enabled work without errors across all exchanges.
Error Messages/Logs
Steps to Reproduce
- Start a Claude Code CLI session with extended thinking enabled (default)
- Have a multi-turn conversation with several tool uses (file reads, edits, etc.)
- After several exchanges, the error appears and repeats on every message
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.117
Platform
AWS Bedrock
Operating System
Other Linux
Terminal/Shell
Other
Additional Information
OS: Arch Linux with Hyprland (wayland compositor)
Terminal: kitty
Shell: bash
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗