400 bad request: Authorization header is badly formatted|Claude Code
Quick fix
Enable local routing in CC Switch; other users recovered with the native API format, default authentication fields, and a VPN.
Symptom
Section titled “Symptom”API Error: 400 bad request: Authorization header is badly formattedWhen Claude Code is launched with the GitHub Copilot provider, the CC Switch launcher may cause Claude Code to use `https://api.githubcopilot.com` and its injected authentication information directly instead of routing through `http://127.0.0.1:15721`. The request then returns 400 because the Authorization header format is rejected. The logs also contain `rejection_type="axum::extract::rejection::MissingJsonContentType"`.
The outcomes in the thread are inconsistent. One user confirmed that enabling local routing fixed the issue, but the original reporter and other users said it remained unresolved. Another user on 3.14.1 recovered after selecting the native API format, retaining the default authentication fields, and enabling both VPN and local routing, but the exact cause was not determined. The maintainer said related changes had been merged into the main branch, but some users still reproduced the issue after rebuilding. Reports also exist for 3.13.0 and 3.14.1.
In CC Switch, go to “Settings → Routing → Local Routing,” enable local routing, restart Claude Code, and send a prompt to test it.
If the error persists, select “Native” as the API format, keep the authentication fields at their defaults, and test again.
If the current network requires a VPN, enable the VPN and retry with local routing. Switching models can be an additional diagnostic step, but the thread indicates that changing only the model may not work.
If the issue persists, try the latest release. When closing the issue, the maintainer recommended CC Switch 4.0.13. If it still occurs, provide the version, operating system, reproduction steps, and relevant logs, then reopen the issue.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 2 real issues
- Has this issue been resolved? The same issue still occurs on 3.13.0.
- The thread has no consistent conclusion. One user confirmed that enabling local routing worked, but another user continued to reproduce the issue on 3.13.0.
- Was this also on 3.14.1? How was it resolved?
- One user on 3.14.1 said the issue was resolved after using the native API format, keeping the default authentication fields, and enabling VPN and local routing, but the exact cause was not found.
- Does cloning again and building the main branch resolve it?
- There is no guarantee. One user said the fix had been merged into the main branch, but another still encountered the same issue after cloning and building again.
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.