[BUG] API Error: 400 Failed to deserialize the JSON body into the target type

Resolved 💬 11 comments Opened May 29, 2026 by chenrui1987 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_

View original on GitHub ↗

This issue has 11 comments on GitHub. Read the full discussion on GitHub ↗