[BUG] VS Code sidebar chat: API Error 400 - messages[1].role unknown variant system
Status Fixed / completed
Reported on v2.1.143
Maintainer reply None cached
Workaround ✓ Mentioned in thread ↓
Activity 3 comments · opened May 29, 2026 · closed May 29, 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?
The VS Code sidebar chat panel always returns API Error 400. When I send any message in the sidebar chat, I get: "Failed to deserialize the JSON body into the target type: messages[1].role: unknown variant system, expected user or assistant"
The terminal claude command works fine with the same subscription account.
What Should Happen?
The sidebar chat panel should send messages and receive responses normally.
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 column 697
Steps to Reproduce
- Install Claude Code VS Code extension (latest version)
- Login with Claude.ai subscription via OAuth
- Open the sidebar chat panel
- Type any message (e.g. "你好") and press Enter
- Error appears immediately: API Error 400 messages[1].role unknown variant system
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.143
Platform
Other
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
3 Comments
The only workaround I found is to roll back to a previous version. This issue was introduced in a recent Claude Code update. You can downgrade via npm:
npm install -g @anthropic-ai/claude-code@2.1.100
I tested this myself and it works.
Found the root cause: I had configured ANTHROPIC_BASE_URL to point to DeepSeek's API endpoint (https://api.deepseek.com/anthropic). DeepSeek's Anthropic-compatible API doesn't fully support the system message format used by the VS Code sidebar panel. Switching back to the official Anthropic endpoint resolved the issue.
Closing this issue.
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.