Repository navigation
[Bug] Anthropic API Error: Assistant message thinking block must be first #20725
Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
Labels
area:apiarea:corearea:modelbugSomething isn't workingSomething isn't workingduplicateThis issue or pull request already existsThis issue or pull request already existsplatform:linuxIssue specifically occurs on LinuxIssue specifically occurs on LinuxstaleIssue is inactiveIssue is inactive
Description
Bug Description
I cant use claude code in linux or mac, all getting error-ed out with API Error (I'm on the MAX plan):
400 {"type":"error","error":{"type":"invalid_request_error","message":"m
essages.5.content.0: If an assistant message contains any thinking blocks, the
first block must be `thinking` or `redacted_thinking`. Found
`text`."},"request_id":"req_011CXTPxYCGvoJZ711qbqL1F"}
If i disable thinking from config, it works. It looks like an account elevl issue as i have it in both my Linux and mac machines.
Environment Info
- Platform: linux
- Terminal: pycharm
- Version: 2.1.19
- Feedback ID: 3bfa7a6e-69c3-4628-b9f3-c1c2dcfba112
Errors
[{"error":"Error: ENOENT: no such file or directory, scandir '/etc/claude-code/.claude/skills'\n at readdirSync (unknown)\n at <anonymous> (/$bunfs/root/claude:12:1903)\n at pJ (/$bunfs/root/claude:11:35427)\n at readdirSync (/$bunfs/root/claude:12:1864)\n at XY$ (/$bunfs/root/claude:2213:380)\n at XY$ (/$bunfs/root/claude:2213:1350)\n at <anonymous> (/$bunfs/root/claude:2213:4440)\n at <anonymous> (/$bunfs/root/claude:2213:5171)\n at A (/$bunfs/root/claude:11:7251)\n at Z71 (/$bunfs/root/claude:4860:4342)","timestamp":"2026-01-25T03:28:06.698Z"},{"error":"Error: ENOENT: no such file or directory, scandir '/home/home/.claude/skills'\n at readdirSync (unknown)\n at <anonymous> (/$bunfs/root/claude:12:1903)\n at pJ (/$bunfs/root/claude:11:35427)\n at readdirSync (/$bunfs/root/claude:12:1864)\n at XY$ (/$bunfs/root/claude:2213:380)\n at XY$ (/$bunfs/root/claude:2213:1350)\n at <anonymous> (/$bunfs/root/claude:2213:4483)\n at <anonymous> (/$bunfs/root/claude:2213:5171)\n at A (/$bunfs/root/claude:11:7251)\n at Z71 (/$bunfs/root/claude:4860:4342)","timestamp":"2026-01-25T03:28:06.698Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.5.content.0: If an assistant message contains any thinking blocks, the first block must be `thinking` or `redacted_thinking`. Found `text`.\"},\"request_id\":\"req_011CXTPxYCGvoJZ711qbqL1F\"}\n at generate (/$bunfs/root/claude:143:37450)\n at makeRequest (/$bunfs/root/claude:160:5435)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-25T03:36:14.831Z"}]Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:apiarea:corearea:modelbugSomething isn't workingSomething isn't workingduplicateThis issue or pull request already existsThis issue or pull request already existsplatform:linuxIssue specifically occurs on LinuxIssue specifically occurs on LinuxstaleIssue is inactiveIssue is inactive
Activity
github-actions commentedon Jan 25, 2026
Found 3 possible duplicate issues:
textbeforethinkingin conversation replay #20705This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
cafferychen777 commentedon Jan 25, 2026
This is the same issue as #20717. The root cause is that the client fails to preserve thinking block ordering when constructing API requests with tool calls while thinking mode is enabled. Disabling thinking mode is the only workaround for now.
abose commentedon Jan 25, 2026
I just installed it freshly on a new mac and its happening there too. (same account).
cafferychen777 commentedon Jan 25, 2026
Update: This issue appears to be fixed now!
Tested with thinking mode + Opus 4.5 — multiple tool calls all succeeded without 400 errors. Please test on your end and confirm!
abose commentedon Jan 25, 2026
Looks like its working now
github-actions commentedon Mar 1, 2026
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
github-actions commentedon Mar 8, 2026
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.