Failed to deserialize the JSON body: unknown variant `image_url` - cc-switch Codex
Quick fix
DeepSeek rejects conversation history after an image has been sent. Start a new conversation to recover.
Symptom
Section titled “Symptom”{"error":{"message":"CC Switch local proxy failed while handling Codex endpoint /responses. Provider: DeepSeek; model: deepseek-v4-flash; upstream_status: HTTP 400; cause: Failed to deserialize the JSON body into the target type: messages[139]: unknown variant `image_url`, expected `text` at line 1 column 387526","type":"invalid_request_error","code":"invalid_request_error","param":null,"provider":"DeepSeek","model":"deepseek-v4-flash","endpoint":"/responses","upstream_status":400}}Sending an image (screenshot) in a Codex conversation adds an `image_url` message to its history. Every subsequent request includes the full history containing that image, but the DeepSeek API (including deepseek-v4-flash and deepseek-v4-pro) only accepts `text` message content. When the cc-switch local proxy forwards a /responses request, the upstream returns HTTP 400 with the deserialization error unknown variant `image_url`, expected `text`. This explains why sending only text afterward, restarting cc-switch, or deleting and reconfiguring the provider does not help: the problem is in that conversation's message history.
A user reported the same error with Qwen3.7-max, which is theoretically a multimodal model. This indicates that the problem concerns upstream API restrictions on message structure, rather than whether the specific model supports images.
Start a new conversation in Codex instead of continuing the existing one. Text messages should then work normally. Multiple users confirmed that even sending screenshots again worked in a new conversation.
If your workflow requires the model to process images, verify that the provider's model actually supports the `image_url` message type. The DeepSeek channel currently does not support it, so images will trigger this error.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 1 real issues
- Will deleting and reconfiguring the provider or switching to deepseek-v4-pro fix this?
- No. Users tried deleting and reconfiguring the provider, switching to deepseek-v4-pro, and restarting cc-switch without success. The error comes from image messages in the current conversation history. Only starting a new conversation resolves it.
- Why does the same error occur even when I only send text afterward?
- Each request includes the full conversation history. The `image_url` image message remains in that history, and the DeepSeek API cannot accept it, so the conversation keeps failing.
- The connection test in cc-switch succeeds, but Codex does not work. Is this the same problem?
- Yes. The connection test only checks the provider configuration and does not include image messages. An actual conversation includes images from its history, triggering the upstream 400 error.
- Why does this error also occur with a multimodal model such as Qwen3.7-max?
- A user reported the same error even with a theoretically multimodal model. This indicates that the limitation lies in the upstream API's deserialization requirements for message structure, rather than the model's image support.
Related problems
Section titled “Related problems”This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.