422 format conversion error: Responses upstream upstream_error: Upstream service temporarily unavailable
Quick fix
Upgrade CC Switch to a version containing the #7787 fix: upstream unavailability will be reported as 502 (UpstreamError), rather than wrapped as 422.
Symptom
Section titled “Symptom”API Error: 422 格式转换错误: Responses upstream upstream_error: Upstream service temporarily unavailableAPI Error: 422 format conversion error: Responses upstream upstream_error: Upstream service temporarily unavailable
In CC Switch 3.20.3, some upstream errors are not returned with a non-2xx HTTP status. Instead, they appear as “HTTP 2xx success response + business failure content,” such as a `status:"failed"` document, `response.failed`/error SSE events during streaming, and an Anthropic `type:"error"` 2xx response.
These failure envelopes were previously classified as “format conversion errors” and uniformly wrapped as 422 for the client. So when the upstream was actually “Upstream service temporarily unavailable,” users saw a 422, which could misleadingly suggest a request format or protocol conversion problem. In #7787, the maintainer changed this behavior to return `UpstreamError` 502 for these cases and preserve the upstream `error.type` and `error.message`. The issue also mentions another parameter incompatibility error, `invalid_request_error: Unsupported parameter: max_tool_calls`, but the maintainer explicitly said it is not addressed by #7787 and requires separate design.
Upgrade CC Switch to a version containing the #7787 fix. It changes upstream responses that return HTTP 2xx but indicate a business failure to 502 (UpstreamError), instead of a 422 format conversion error.
After upgrading, access Claude Code through the local CC Switch proxy again and check whether the logs stop showing this kind of 422-wrapped error: `[FWD-003] ... 响应转换失败: Responses upstream upstream_error: Upstream service temporarily unavailable`.
If you cannot upgrade yet, you can temporarily use a community-provided retry proxy as a workaround: insert https://github.com/HKLHaoBin/cc-switch-422-retry-proxy between the Claude client and CC Switch local routing. It retries 422 overload errors, 502/503/504 responses, and connection errors with backoff. This is a temporary third-party solution, not an official fix, and carries risks such as duplicate requests and buffering the entire stream.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 1 real issues
- Why does an unavailable upstream service produce a 422 format conversion error?
- Some upstream errors are returned as failure content in an HTTP 2xx response. Older versions mistakenly classified these responses as format conversion errors, so they were ultimately wrapped as 422.
- Will this fix affect failover?
- No. The maintainer said the old 422 classification was already retryable, and the new 502 is also in the same retryable error class, so failover behavior is unchanged.
- Is `Unsupported parameter: max_tool_calls` fixed as well?
- No. The maintainer explicitly said this parameter incompatibility is not included in #7787 and requires a separately designed approach in the request-shaping layer.
- Is there a temporary workaround?
- A user provided a temporary third-party retry proxy at https://github.com/HKLHaoBin/cc-switch-422-retry-proxy. It can intercept and retry 422 overload errors, but carries risks such as duplicate requests, duplicate charges, and delayed streaming output.
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.