#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 494#

 

这个报错说明:
Claude Code 发给 DeepSeek 的消息里,出现了第二个 system 角色。
而 DeepSeek 的 Anthropic 兼容接口只允许:messages[0] = system
 

这不是你配置坏了。

而是:

  • Claude Code 新版本
  • tools / memory / context
  • 某些 agent 模式

会自动插入多个 system message。

但 DeepSeek 不兼容。


目前最简单稳定的办法:降级 Claude Code
npm install -g @anthropic-ai/claude-code@2.1.148
或者
npm install -g @anthropic-ai/claude-code@2.1.152
推荐直接:
npm uninstall -g @anthropic-ai/claude-code
npm install -g @anthropic-ai/claude-code@2.1.152
然后再打开 CC Switch。

Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐