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.
Symptom
Section titled “Symptom”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 stringIn 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.
Upgrade CC Switch to v3.20.4, then send a message in the original session to confirm whether the historical image request has recovered.
If the same 422 still occurs, do not keep retrying that session. Start a new session and provide the task context again.
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.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 1 real issues
- 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.
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.