Skip to content

Config lost after switching: Claude Code / Codex / WSL path check

Quick fix

Switching provider rewrites settings.json. Put hooks/statusLine/enabledPlugins into the shared/general config, not just the local file.

Error output
切换 provider 后 hooks 字段丢失,插件及自定义脚本失效
English translation

The hooks field is lost after switching provider, breaking plugins and custom scripts

cc-switch generates the live config file from the selected provider's configuration and rewrites it when you switch provider or restart proxy routing — ~/.claude/settings.json for Claude Code, ~/.codex/config.toml for Codex. If you write hooks, enabledPlugins, statusLine, permissions, skipDangerousModePermissionPrompt, a Codex project trust_level, and similar fields straight into the local config file without adding them to cc-switch's general / shared config fragment, they are wiped on the next switch.

Some issues cover other variants: a leftover third-party mirror/proxy placeholder can turn a switch into a no-op; Claude Desktop and Claude Code use different config directories, so a hand-created ~/.claude/settings.json may pass a file-exists check without actually taking effect; and Codex unified session history can be silently skipped when an official provider sets model_provider = "openai" explicitly. These are different root causes that all present as config not applying or being overwritten after a switch.

  1. Confirm you are using the Claude Code CLI rather than only Claude Desktop. Claude Code normally reads ~/.claude/settings.json — %USERPROFILE%\.claude\settings.json on native Windows, /home/<username>/.claude/settings.json inside WSL.

  2. Open the provider edit screen in cc-switch, find the shared / general config panel, and use 从当前供应商提取 (extract from current provider) or a similar entry point to pull enabledPlugins, hooks, statusLine, permissions and any other fields you need across providers into the shared config.

  3. Save, switch provider again, and check the live config file kept those fields.

    ~/.claude/settings.json
    {
    "env": { },
    "enabledPlugins": { },
    "hooks": { },
    "statusLine": { }
    }
  4. If it still does not apply after switching, check your cc-switch version. A leftover third-party proxy placeholder making switches ineffective is mentioned among the v3.16.2 fixes — upgrade to v3.16.2 or newer and retry.

  5. On Codex, if you have to re-confirm Hooks trust, Sandbox, or a project trust_level after every switch, move those project-level settings into the cc-switch shared config; otherwise re-confirmation may be needed each time.

ToolClaude Code / Codex
VersionUnknown
PlatformsWindowsmacOSLinux
Why does switching provider in cc-switch overwrite settings.json?
A maintainer explained this is by design: the live config file is generated from the selected provider config and rewritten on a switch. Fields you need across providers belong in the shared / general config rather than only in the local settings.json.
How do I keep enabledPlugins, hooks, and statusLine?
On the provider edit page in cc-switch, find the shared / general config panel and use 从当前供应商提取 (extract from current provider) to pull enabledPlugins, hooks, statusLine and similar fields out, so they travel with a provider switch.
I cannot find where to edit the general config.
Users report you can set up any provider on the cc-switch Claude Code screen, then find the general / shared config panel inside that provider's settings, read the settings.json you already configured, and save it as the default general config.
Do Claude Desktop and Claude Code share one config?
No. The issues note Claude Desktop and Claude Code use different configs; cc-switch mainly manages the Claude Code CLI's ~/.claude/settings.json. With only Claude Desktop installed, that directory may not be created at all.
claudecode.environmentVariables in VS Code does not change after switching provider. What now?
An issue mentions the matching write feature has to be enabled in cc-switch. If you wrote the plugin config separately in VS Code, that config may not be rewritten. Confirm the relevant sync/write option is on in cc-switch.
Can a script restore the wiped fields automatically?
A user offered a temporary workaround: a Claude Code PostToolUse hook that restores statusLine, permissions, hooks and similar fields after each tool call. It is not an official final answer, and there is still a window between the switch and the first tool call.
Why do I have to re-confirm Hooks trust or Sandbox after a Codex switch?
Because the related config may be rewritten when you switch provider. Users report that even launching with codex --dangerously-bypass-approvals-and-sandbox --dangerously-bypass-hook-trust still prompts again after a switch. Move the settings you need into the cc-switch shared config.

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.