http://127.0.0.1:15721 proxy configuration stuck - CC Switch
Quick fix
Upgrade to CC Switch v3.16.2 to fix proxy hangs from corrupted backups, or use "Replace Config" mode to manually set env vars.
Symptom
Section titled “Symptom”{"env":{"ANTHROPIC_AUTH_TOKEN":"PROXY_MANAGED","ANTHROPIC_BASE_URL":"http://127.0.0.1:15721"}}In versions prior to CC Switch v3.16.2, if a crash or unwritable file occurs during takeover, proxy_live_backup may incorrectly save proxy placeholders (such as PROXY_MANAGED and 127.0.0.1:15721) as the original backup. When users attempt to disable the proxy, the program blindly writes this corrupted backup back to the Live config file, causing Claude Code or Codex configurations to permanently hang on the local proxy port, resulting in an infinite restart loop. Additionally, for custom relay scenarios using CLIProxyAPI, CC Switch's proxy mode tests may fail due to hardcoded model names (e.g., claude-haiku-4-5-20251001).
Upgrade CC Switch to v3.16.2 or later. This version fixes the backup path detection logic; it skips saving when encountering placeholders and rebuilds the Live config from the current provider, resolving the issue where the proxy toggle becomes a no-op.
For custom relay scenarios like CLIProxyAPI, since the proxy mode's model check is not fully adapted, it is recommended to disable CC Switch's proxy mode and directly use "Replace Config" mode to manually overwrite environment variables.
// ~/.claude/settings.json{"env": {"ANTHROPIC_AUTH_TOKEN": "sk-xxxx","ANTHROPIC_BASE_URL": "https://cpa.xxxx.com","ANTHROPIC_DEFAULT_HAIKU_MODEL": "gemini-3-flash-preview","ANTHROPIC_DEFAULT_OPUS_MODEL": "gemini-3-pro-preview","ANTHROPIC_DEFAULT_SONNET_MODEL": "gemini-3-pro-preview","ANTHROPIC_MODEL": "gemini-3-pro-preview","ANTHROPIC_REASONING_MODEL": "gemini-3-pro-preview","CLAUDE_CODE_ATTRIBUTION_HEADER": "false","CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "true"}}
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 2 real issues
- Why can't Claude Code connect after disabling the proxy?
- Because the CC Switch backup file is corrupted, disabling the proxy wrote the placeholder containing 127.0.0.1:15721 back into the config file. Please upgrade to v3.16.2 to fix this issue.
- What should I do if CC Switch reports errors when testing with CLIProxyAPI relay?
- CC Switch's proxy mode model check is not yet fully adapted for custom relays, and tests use hardcoded models. It is recommended to disable proxy mode and manually add environment variables directly in the config file (using "Replace Config" mode).
- How to solve Codex desktop version proxy constantly flapping?
- This is an independent issue where Codex desktop hot-reloads config.toml, causing CC Switch to mistakenly judge that takeover was lost. It is recommended to watch for future version fixes, or temporarily switch to "Replace Config" mode.
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.