Skip to content

Old Provider API Key Overwrites Current Configuration During Proxy Recovery - cc-switch

Quick fix

Upgrade to v4.0.0 or later; the redesigned local routing no longer restores keys from old backups.

Error output
重启完成后,**当前 provider 的 `settings_config` 里的 API key 被替换成了上一个 provider 的 key**。多次切换/重启会让各 provider 的 key 互相"洗牌"(实测出现 P1↔P3 的 key 互换、官方 provider 被写入第三方中转的 key),过程完全静默,直到上游返回 401(令牌已过期或验证不正确)才暴露。
English translation

After the restart completed, the API key in the current provider’s `settings_config` was replaced with the previous provider’s key. Repeated switching and restarting can cause the providers’ keys to get “shuffled” among them (testing showed P1↔P3 key swaps, and a third-party relay key being written to the official provider). The process is completely silent until the upstream returns 401 (the token has expired or is invalid), revealing the problem.

The old recovery path in cc-switch 3.20.0 first restored the previous Provider’s key to the Live configuration, then synced the key from Live to the current Provider. If a user switched the current Provider externally, outside the GUI, and then restarted the service, the key in Live could belong to a different Provider and silently overwrite the current configuration.

  1. Upgrade to v4.0.0 or later. The maintainer said the new version’s local routing no longer depends on restoring backups, so the old key write-back path no longer exists. The installer is available from the official Releases page.

ToolClaude Code / Codex
Version3.20.0(受影响);v4.0.0 起该恢复路径已移除
PlatformsLinux
What should I do if the problem persists after upgrading to v4.0.0?
The maintainer recommends adding more information and reopening the Issue.

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.