[BUG] API Error: 400
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?
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.11.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 (preceeding 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. Please
consult our documentation at
https://docs.claude.com/en/docs/build-with-claude/extended-thinking"},"request_id":"req_011CXTQEEFyCPGnrEPNhaQu8"}
What Should Happen?
Expectation is to run the code without this error
Error Messages/Logs
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.11.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 (preceeding 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`. Please
consult our documentation at
https://docs.claude.com/en/docs/build-with-claude/extended-thinking"},"request_id":"req_011CXTQEEFyCPGnrEPNhaQu8"}
Steps to Reproduce
I dont know, I just started to run code and this keeps happening
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.19
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
PowerShell
Additional Information
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.11.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 (preceeding 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. Please
consult our documentation at
https://docs.claude.com/en/docs/build-with-claude/extended-thinking"},"request_id":"req_011CXTQEEFyCPGnrEPNhaQu8"}
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗