[BUG] API Error: 400 Failed to deserialize the JSON body into the target type
Status Closed — not planned
Reported on v2.1.154
Maintainer reply None cached
Workaround ✓ Mentioned in thread ↓
Activity 11 comments · opened May 29, 2026 · closed Jul 7, 2026
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?
I'm using the Deepseek-v4-pro model, when I chat to Claude,Claude shows the error:API Error: 400 Failed to deserialize the JSON body into the target type: messages[1].role: unknown variant system, expected user or assistant at line 1
What Should Happen?
Claude should answer me and work successful.
Error Messages/Logs
API Error: 400 Failed to deserialize the JSON body into the target type: messages[1].role: unknown variant system, expected user or assistant at line 1
Steps to Reproduce
Just open a new session and chat to Claude.
Claude Model
Other
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.154 the latest version
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
11 Comments
https://www.reddit.com/r/DeepSeek/comments/1tqiz97/deepseek_not_working_with_claude_code/
Doing this and source ~/,bashrc worked for me as a temporary fix.
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
+1
+1
版本降级后恢复:npm install -g @anthropic-ai/claude-code@2.1.153
+1 and hope it will be solved asap
I resolved the issue by downgrading the version. Today, I saw a message saying "opus-4.8 is available," which likely means the Claude Code CLI updated itself in the background. Then the same problem appeared in this issue (I'm also using Deepseek-v4). I tried the methods online and those suggested by the AI and found a solution:
The problem was subsequently resolved. This was most likely caused by an official Claude update I guess.
Install a lower version: npm install -g @anthropic-ai/claude-code@2.1.153
Thanks
Today I am experiencing a different kind of error, which is
API Error: 400 Failed to deserialize the JSON body into the target type: messages[6]: unknown variant 'thinking', expected 'text'I have tried on version 2.1.152, 2.1.152 and 2.1.148 with no luck. Anyone else experiencing this?
Closing for now — inactive for too long. Please open a new issue if this is still relevant.