Skip to content

[BUG] Claude Code for VS Code API Error: 400 messages[1].role must be either 'user' or 'assistant', but got 'system' #63473

@hswyxj

Description

@hswyxj

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

  • Claude Code for VS Code 报错信息 messages[1].role must be either 'user' or
    'assistant', but got 'system'
  • CLI 正常但 VS Code 扩展Claude Code for VS Code报错

What Should Happen?

Claude 应该正常回复信息

Error Messages/Logs

Steps to Reproduce

1.Claude Code for VS Code发送任何信息
2.出现错误:"API Error: 400 messages[1].role must be either 'user' or 'assistant', but got 'system'"

  • CLI 正常但 VS Code 扩展Claude Code for VS Code报错

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.156

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Other

Additional Information

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions