Skip to content

[Bug] Anthropic API Error: Invalid message format with thinking blocks #20691

Open

Description

@andrewgazelka

Bug Description
cant use claude code constnatly getting ⏺ Read(docker/docker-bake.hcl)
⎿  Read 89 lines
⎿ API 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_011CXT8bUDaez2FNQumfnTPe"}

Environment Info

  • Platform: darwin
  • Terminal: ghostty
  • Version: 2.1.19
  • Feedback ID: c0f6e016-cc3b-433a-b286-27c4f4c46282

Errors

[{"error":"Error: ENOENT: no such file or directory, scandir '/Library/Application Support/ClaudeCode/.claude/skills'\n    at readdirSync (unknown)\n    at <anonymous> (/$bunfs/root/claude:12:1903)\n    at mW (/$bunfs/root/claude:11:35435)\n    at readdirSync (/$bunfs/root/claude:12:1864)\n    at ILR (/$bunfs/root/claude:2215:380)\n    at ILR (/$bunfs/root/claude:2215:1350)\n    at <anonymous> (/$bunfs/root/claude:2215:4440)\n    at <anonymous> (/$bunfs/root/claude:2215:5171)\n    at A (/$bunfs/root/claude:11:7259)\n    at FZ8 (/$bunfs/root/claude:4862:4342)","timestamp":"2026-01-25T00:13:23.635Z"},{"error":"Error: EACCES: permission denied, open '/nix/store/in0m73y8lbimzsvwkfy1q6ncivcshxlc-home-manager-files/.claude.json.tmp.51302.1769300003955'\n    at writeFileSync (unknown)\n    at BF (/$bunfs/root/claude:5244:631)\n    at qoB (/$bunfs/root/claude:5244:5059)\n    at DA (/$bunfs/root/claude:5244:2646)\n    at Mz8 (/$bunfs/root/claude:6111:9765)\n    at <anonymous> (/$bunfs/root/claude:6144:5321)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-01-25T00:13:23.955Z"},{"error":"Error: EACCES: permission denied, open '/nix/store/in0m73y8lbimzsvwkfy1q6ncivcshxlc-home-manager-files/.claude.json.tmp.51302.1769300004049'\n    at writeFileSync (unknown)\n    at BF (/$bunfs/root/claude:5244:631)\n    at qoB (/$bunfs/root/claude:5244:5059)\n    at B4 (/$bunfs/root/claude:5257:227)\n    at SmB (/$bunfs/root/claude:4307:8674)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-01-25T00:13:24.049Z"},{"error":"Error: EACCES: permission denied, open '/nix/store/in0m73y8lbimzsvwkfy1q6ncivcshxlc-home-manager-files/.claude.json.tmp.51302.1769300010505'\n    at writeFileSync (unknown)\n    at BF (/$bunfs/root/claude:5244:631)\n    at qoB (/$bunfs/root/claude:5244:5059)\n    at DA (/$bunfs/root/claude:5244:2646)\n    at <anonymous> (/$bunfs/root/claude:5940:7816)\n    at SA (/$bunfs/root/claude:546:62518)\n    at Ne (/$bunfs/root/claude:546:75470)\n    at l2 (/$bunfs/root/claude:546:75354)\n    at Ne (/$bunfs/root/claude:546:76254)\n    at l2 (/$bunfs/root/claude:546:75354)","timestamp":"2026-01-25T00:13:30.505Z"},{"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_011CXT8bUDaez2FNQumfnTPe\"}\n    at generate (/$bunfs/root/claude:144:37450)\n    at makeRequest (/$bunfs/root/claude:161:5435)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-01-25T00:14:46.610Z"},{"error":"Error: EACCES: permission denied, open '/nix/store/in0m73y8lbimzsvwkfy1q6ncivcshxlc-home-manager-files/.claude.json.tmp.51302.1769300086635'\n    at writeFileSync (unknown)\n    at BF (/$bunfs/root/claude:5244:631)\n    at qoB (/$bunfs/root/claude:5244:5059)\n    at DA (/$bunfs/root/claude:5244:2646)\n    at oV8 (/$bunfs/root/claude:5933:16798)\n    at N_0 (/$bunfs/root/claude:5933:16921)\n    at V_0 (/$bunfs/root/claude:5938:527)\n    at <anonymous> (/$bunfs/root/claude:5938:52464)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-01-25T00:14:46.635Z"},{"error":"Error: EACCES: permission denied, open '/nix/store/in0m73y8lbimzsvwkfy1q6ncivcshxlc-home-manager-files/.claude.json.tmp.51302.1769300086638'\n    at writeFileSync (unknown)\n    at BF (/$bunfs/root/claude:5244:631)\n    at qoB (/$bunfs/root/claude:5244:5059)\n    at DA (/$bunfs/root/claude:5244:2646)\n    at oV8 (/$bunfs/root/claude:5933:16798)\n    at N_0 (/$bunfs/root/claude:5933:16921)\n    at V_0 (/$bunfs/root/claude:5938:527)\n    at <anonymous> (/$bunfs/root/claude:5938:52464)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-01-25T00:14:46.638Z"}]

Activity

  1. github-actions commented on Jan 25, 2026

    @github-actions

    Found 2 possible duplicate issues:

    1. [Bug] Anthropic API Error: Invalid message structure with thinking blocks #20689
    2. [BUG] "invalid_request_error","message":"messages.213.content.0.type: Expected thinking or redacted_thinking, but found text. #11191

    This issue will be automatically closed as a duplicate in 3 days.

    • If your issue is a duplicate, please close it and 👍 the existing issue instead
    • To prevent auto-closure, add a comment or 👎 this comment

    🤖 Generated with Claude Code

  2. SeanHollen commented on Jan 25, 2026

    @SeanHollen

    Not to just make a "me too" post, but since this is new, I'll add my information.

      ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.23.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_011CXTBQq7j3X9cT8feewAeV"}                        
    

    Claude doctor

     Diagnostics                                                                                                                                                                                                       
     └ Currently running: npm-global (2.1.19)                                                                                                                                                                          
     └ Path: /usr/local/bin/node                                                                                                                                                                                       
     └ Invoked: /usr/local/bin/claude                                                                                                                                                                                  
     └ Config install method: unknown                                                                                                                                                                                  
     └ Search: OK (vendor)                                                                                                                                                                                             
     Warning: Insufficient permissions for auto-updates                                                                                                                                                                
     Fix: Do one of: (1) Re-install node without sudo, or (2) Use `claude install` for native installation                                                                                                             
                                                                                                                                                                                                                       
     Updates                                                                                                                                                                                                           
     └ Auto-updates: enabled                                                                                                                                                                                           
     └ Update permissions: No (requires sudo)                                                                                                                                                                          
     └ Auto-update channel: latest                                                                                                                                                                                     
     └ Stable version: 2.1.7                                                                                                                                                                                           
     └ Latest version: 2.1.19                                                                                                                                                                                          
                                                                                                                                                                                                                       
     Version Locks                                                                                                                                                                                                     
     └ No active version locks                                                                                                                                                                                         
    

    A few things to clarify, how this is different than other reports:

    • This is not tied to compaction; I saw the issue early in my session, and I did not run /compact
    • This is not tied to /context, I didn't run it
    • It is not tied to switching models or switching settings quickly; I had never switched models until I saw this issue
    • It is not tied to my local environment. I saw this issue separately on my local MacBook as well as with CC running within a VPS which does not have my usual plugins
    • I was using Opus 4.5 with thinking. I have not seen this issue after switching models
    • claude --version: 2.1.19 (Claude Code)
    • I don't see it immediately after the first prompt in the session, but soon within the session
    • CC is talking to Anthropic directly, not through a proxy, and not via a third-party client like OpenCode
    • I do not want to disable thinking

    Last messages seen before the error:

    The issue is that cabal.project is being interpreted as a second .cabal file. It should be named cabal.project.local or more commonly just deleted — the single-package default works fine without it. 
    
    ⏺ Bash(rm /Users/seanhollen/code/haskell-1/cabal.project) 
    ⎿  (No content) 
    ⎿ API Error: 400 {"type":"error","error": [...]
    
  3. cafferychen777 commented on Jan 25, 2026

    @cafferychen777

    Same issue here — #20717. This appears to be a regression from today (Jan 25). At least 7 issues reported in the last few hours: #20691, #20692, #20698, #20711, #20717, #20725, #20726. Thinking mode is completely unusable with tool calls. If you're affected, please upvote and comment on the related issues to help get this fixed!

  4. Alyfish commented on Jan 25, 2026

    @Alyfish

    ⎿ API 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_011CXTTUY143pJroriaiunm9"} seeing the same error

  5. cafferychen777 commented on Jan 25, 2026

    @cafferychen777

    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!

  6. silverwind commented on Feb 15, 2026

    @silverwind

    redacted_thinking erors are till happening with opus 4.6. Switching /model to sonnet works and it can continue the work after but switching back to opus gives the error again, so opus is in a persistent broken state after this error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:apibugSomething isn't workingplatform:macosIssue specifically occurs on macOSstaleIssue is inactive

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions