Skip to content

settings.json config lost after switching providers - CC Switch

Quick fix

Use the "Shared Config Snippet" feature to extract and preserve custom fields like hooks/statusLine so they are carried over automatically on switch.

Error output
切换后发现 hooks 字段被完全覆盖/丢失,相关插件、自动化脚本、hooks 行为全部失效
English translation

After switching, the hooks field is found to be completely overwritten/lost, and related plugins, automation scripts, and hooks behavior all stop working

When switching providers, CC Switch rewrites `~/.claude/settings.json` with the selected provider's config; this is intentional design behavior. Since a provider config only contains provider-related fields like env and model, the write keeps only cc-switch built-in fields, and manually added fields such as hooks, enabledPlugins, and statusLine are fully overwritten or cleared. This issue persisted across many versions from v3.8.3 to v3.19.2. v3.11.0 introduced a "partial field merge" mechanism, but it was reverted in v3.11.1 (commit `859f4137`), restoring full-overwrite mode. The maintainer confirmed this is by design and recommends the "Shared Config Snippet" feature to retain shared data. Additionally, some users could not switch providers after using third-party mirrors/routers, possibly related to the "proxy placeholder backup/restore loop" fixed in v3.16.2 — previously, if a proxy left placeholders in the Live config when stopped, switching became a no-op.

  1. In CC Switch, edit the current provider and find the "Shared Config" panel.

  2. Click "Extract from current provider" to extract shared fields such as enabledPlugins, hooks, and statusLine into a shared config.

  3. After saving, when you switch to another provider, the shared config is automatically merged into settings.json, and custom fields are no longer lost.

  4. If you use VSCode and switching has no effect, check whether the "Write common config" option is enabled in CC Switch settings. If plugin config is written separately in VSCode, this feature will not overwrite it; ensure plugin config is not written separately or sync it manually.

  5. If you use Codex and project-related settings like trust_level are lost after switching, you currently need to re-extract the shared config after first confirming each new project, or use a PostToolUse hook to restore them automatically.

  6. Temporary workaround: use a Claude Code PostToolUse hook to automatically restore lost fields. Create a restore script and add a hook entry in settings.json so missing fields are re-added after each tool call.

ToolClaude Code / Codex
Version3.8.3 - 3.19.2(受影响版本范围)
PlatformsWindowsmacOSLinux
What should I do if the statusLine config in settings.json disappears after switching providers?
This is CC Switch's design behavior: settings.json is rewritten on switch. Use the "Shared Config Snippet" feature: edit the provider → Shared Config panel → "Extract from current provider", and shared fields like statusLine will be carried over automatically on switch.
Can the original settings.json be recovered after being overwritten?
Yes. On first run, CC Switch reads all config into the default provider, so the original config is fully preserved in the default provider imported at first launch and can be recovered at any time.
What should I do if claudecode.environmentVariables does not change after switching providers in VSCode?
Check whether the "Write common config" feature is enabled in CC Switch settings. If plugin config is written separately in VSCode, this feature will not overwrite it; the feature works when plugin config is not written separately.
What should I do if Claude is unavailable in the terminal opened via the >_ button in the CC Switch UI?
The built-in terminal's shell environment may differ from your usual terminal, and the node/claude paths may not be configured. It is recommended to run claude directly from a system terminal (PowerShell, iTerm2, etc.); CC Switch writes the config to settings.json, which the system terminal can read normally.
What should I do if it says "Claude config file does not exist"?
CC Switch manages the Claude Code CLI config directory (e.g., %USERPROFILE%\.claude\settings.json on Windows), not Claude Desktop. Make sure the Claude Code CLI is installed and the claude command has been run once in a terminal to generate the ~/.claude directory. If you use WSL, CC Switch's config directory must point to the .claude directory in WSL.
What should I do if enabledPlugins is set to null after switching providers, disabling all plugins?
v3.11.1 reverted the partial field merge mechanism, causing this issue. You can pass plugin data via common config (shared config snippets), or use proxy mode (in proxy mode, switching does not write to the live config and does not trigger this issue).
What should I do if project-related settings like Codex's trust_level are lost after switching?
trust_level is project-related and gets replaced when switching providers. Currently, with shared config snippets you need to extract once for each new project started. You can also consider using a PostToolUse hook for automatic restoration.

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.