settings.json Full Overwrite Causes Plugin Failure - CC Switch
Quick fix
Upgrade to v3.20.1+ to fix the bug that clears enabledPlugins when switching configs.
Symptom
Section titled “Symptom”[Bug] 切换 Claude Code 配置时 settings.json 被全量重写,enabledPlugins / statusLine 等字段被清空或重置[Bug] settings.json is fully overwritten when switching Claude Code configurations, causing fields such as enabledPlugins and statusLine to be cleared or reset.
In cc-switch versions prior to v3.19.x, three overlapping bugs caused issues: Common Config was only extracted once and not updated, the switch process did not write back Common Config, and auto-inference logic failed. Consequently, cc-switch used a strategy of reading an internal template and overwriting `~/.claude/settings.json` entirely, rather than incrementally merging. As a result, non-supplier-specific fields like `enabledPlugins`, `statusLine.command` were cleared or reset to defaults, causing user-defined plugins and status bar scripts to fail silently.
This issue has been fixed in subsequent versions by introducing an incremental merge mechanism that ensures only supplier-related `env` fields are updated while preserving other user configurations.
Upgrade cc-switch to the latest version (v3.20.1 or higher) to obtain the version containing this fix.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 9 real issues
- #2694代理模式开启之后,模型映射没有写到 settings.json 中
- #2705为何明明启用了某个大模型,但在中断输出相关环境变量却是空的?
- #2961Claud Code无法调用BASH命令
- #3486Failover 切换 provider 时未同步更新 API Base URL,导致 400 错误
- #3631[Bug] 切换 Claude Code 配置时 settings.json 被全量重写,enabledPlugins / statusLine 等字段被清空或重置
- #4228[Feature] 代理接管模式下不应向 Claude Code settings.json 写入 ANTHROPIC_*_MODEL 字段
- #4404Reasoning model responses produce hundreds of fragmented `content_block_start` events instead of 2 (one thinking + one text)
- #4707火山方舟 detect_provider 仅匹配 api/coding,遗漏了 Agent Plan 的 api/plan 路径
- #6922[claude][proxy] GET /v1/models 对 Claude 槽位返回 Codex 格式响应体(unexpected body / model list endpoint format mismatch)
- Will my old configuration be lost after upgrading?
- No. Upgrading only replaces the binary file. Since the previous bug already caused some configuration loss, it is recommended to re-check whether plugins and status bar configurations in `~/.claude/settings.json` are intact after upgrading. Manually restore if necessary.
- Why didn't I have this problem with routing mode enabled before?
- Routing mode primarily involves the pointing of `ANTHROPIC_BASE_URL` and model mapping logic (see #2694). The core of this Issue is the incorrect overall write strategy of the `settings.json` file. Regardless of whether routing is enabled, as long as a config switch is triggered and the version is lower than the fixed version, the overwrite behavior that clears fields will occur.
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.