Skip to content

Input should be a valid string: Codex image history 422

Quick fix

Most related issues remain unresolved. Upgrade to cc-switch v3.20.4 and retry. If 422 persists, start a new session or roll back before the image.

Error output
unexpected status 422 Unprocessable Entity: CC Switch local proxy failed while handling Codex endpoint /responses.
Provider: OpenCode Go; model: deepseek-v4.1-flash; upstream_status: HTTP 422;
cause: Upstream request failed: [invalid_request_error] Input should be a valid string

In a long Codex session where CC Switch converts requests to Chat requests, an image result from `view_image` enters the history and subsequent requests consistently return 422 at `messages.903.user.content.str`. This affects only sessions containing that historical message; the same proxy, model, and short sessions can make requests normally.

The maintainer stated that v3.20.4 rewrites `detail: "original"` for images in synthesized user messages to `auto`, for compatibility with strict upstreams that accept only `auto`, `low`, and `high`. However, the reporter's minimal reproduction did not confirm that `original` was the sole cause in this case, so whether upgrading restores the existing session still requires verification.

  1. Upgrade CC Switch to v3.20.4, then send a message in the original session to confirm whether the historical image request has recovered.

  2. If the same 422 still occurs, do not keep retrying that session. Start a new session and provide the task context again.

  3. If possible, roll back to a turn before the `view_image` image entered the history so that image history message is excluded from later requests.

ToolCodex
Version3.20.3(受影响)
PlatformsWindows
Can the original session recover after upgrading to v3.20.4?
The maintainer recommends sending another message in the original session after upgrading. This version applies the `original` to `auto` rewrite to existing history as well, but the result after upgrading has not been confirmed in this case.
What should I do if the same 422 still occurs?
Reply that the issue still reproduces. As a temporary workaround, start a new session or roll back to a turn before the image appeared.

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.