Deleted provider remains in tray and switching silently fails - cc-switch
Quick fix
No verified solution is available. Residual tray entries and env in ~/.claude.json can make provider switching appear successful but have no effect.
Symptom
Section titled “Symptom”删除一个供应商后,托盘菜单中仍然显示该供应商的条目。点击该条目后 CC Switch 静默"切换成功",没有任何错误提示,但实际写入 `~/.claude/settings.json` 的配置不可预期,导致后续切换到其他供应商(如 Claude Official)后,Claude Code 仍然使用已删除供应商的 API。After deleting a provider, its entry still appears in the tray menu. Clicking it makes CC Switch silently report "切换成功" with no error, but the configuration written to `~/.claude/settings.json` is unpredictable. After switching to another provider, such as Claude Official, Claude Code still uses the deleted provider's API.
The original post separates this into three layers. First, the tray menu does not refresh after a provider is deleted, so the deleted entry remains. Clicking it makes CC Switch query settings_config for a nonexistent provider; the behavior is unpredictable and no error is logged, with logs only showing "切换到Claude供应商: xxx". Second, CC Switch switches providers by writing the env field in ~/.claude/settings.json, but a running Claude Code process does not hot-reload that file. Its environment variables are fixed at process startup, so switching without restarting Claude Code still uses the old provider API. Third, the reporter identified that Claude Code also reads env configuration from ~/.claude.json in the home directory, while CC Switch write_live_snapshot only overwrites ~/.claude/settings.json. Residual ANTHROPIC_AUTH_TOKEN / ANTHROPIC_BASE_URL values in ~/.claude.json therefore remain effective, even if settings.json correctly contains "env": {}; switching appears successful but has no effect. This issue remains open, with no maintainer-confirmed fix or merged patch.
The original post does not provide a verified solution. Issue #1096 remains open; follow the issue for updates.
The reporter proposed the following expected behavior, which is not maintainer-confirmed: immediately refresh the tray menu after deleting a provider and remove its entry; if a deleted entry is clicked, show "该供应商已被删除" and skip switching.
The reporter suggested this unverified troubleshooting direction: check ~/.claude.json in the home directory (note that this differs from ~/.claude/settings.json), manually remove residual ANTHROPIC_AUTH_TOKEN and ANTHROPIC_BASE_URL values from its env field, then restart Claude Code so the new provider configuration takes effect.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 1 real issues
- Why does Claude Code still show the old provider base URL after switching back to Claude Official?
- The reporter concluded that Claude Code also reads env configuration from ~/.claude.json, while CC Switch only overwrites ~/.claude/settings.json. Residual ANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN values in ~/.claude.json remain effective.
- Do I need to restart Claude Code after switching providers?
- Yes. The original post states that CC Switch switches providers by writing the env field in ~/.claude/settings.json, but a running Claude Code process does not hot-reload that file. Environment variables are fixed at process startup, so without restarting it still uses the old provider API.
- Why can I still see a provider in the tray menu after deleting it?
- This is the main bug reported in the original post: the tray menu is not refreshed after deletion, so the deleted entry remains. Clicking it makes CC Switch query a nonexistent provider and silently fail with no error message. No confirmed fix is available.
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.