[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
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

  1. Install Claude Code VS Code extension (latest version)
  2. Login with Claude.ai subscription via OAuth
  3. Open the sidebar chat panel
  4. Type any message (e.g. "你好") and press Enter
  5. 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_

View original on GitHub ↗

3 Comments

KKKKumori · 4 months ago

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.

idea-songyaqi · 4 months ago

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.

github-actions[bot] · 2 months ago

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.