Routing State Switch Failed: Claude Configuration File Does Not Exist - cc-switch
Quick fix
If .claude is missing, run Claude Code once to generate the configuration before enabling routing. Upgrade to v3.16.2 if the message only shows {{detail}}.
Symptom
Section titled “Symptom”切换路由状态失败:{{detail}}Routing State Switch Failed:{{detail}}
If the local user directory has no .claude folder (the Claude configuration has not yet been generated), enabling Claude routing in cc-switch fails because the backend cannot find the configuration file and reports “Claude configuration file does not exist.” Before v3.16.2, the routing panel (ProxyPanel) did not insert backend error details into the i18n text when switching failed, so the {{detail}} placeholder appeared literally. The main interface routing toggle used a different code path and displayed the actual error, making the two messages inconsistent. This placeholder issue was fixed in v3.16.2 (#3656, commit ce538265); after the fix, both locations display the actual backend error details. Note that the reporter for #3947 encountered “local routing Claude code failed to enable access” and “switching providers with the software failed to enable” on 3.16.2. The maintainer said version 4.0 rewrote provider switching, local routing, and the Skills page, but the user reported that the issue persisted on the new version. If routing still fails after upgrading, it may be related to the connected third-party API, such as DeepSeek, or to the specific provider configuration; this remains unresolved.
First confirm that the Claude configuration exists on your machine: start and sign in to Claude Code once in a terminal so it creates the .claude folder and configuration file in your user directory.
Once the configuration file exists, return to cc-switch and enable Claude routing; takeover should then succeed.
If the message literally says “Routing State Switch Failed:{{detail}}” instead of showing the actual cause, your version is outdated. Upgrade cc-switch to v3.16.2 or later; both messages will then show the actual backend error details, such as “Claude configuration file does not exist.”
If routing or provider switching still fails after upgrading, as reported in #3947, try version 4.0. If the issue persists, report the exact error text, provider, and version, and file one issue per problem.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 2 real issues
- Why does the routing panel show “Routing State Switch Failed:{{detail}}” while the main interface toggle shows the actual cause?
- This was a bug before v3.16.2: when switching failed, the routing panel (ProxyPanel) did not pass backend error details to the i18n text, so the {{detail}} placeholder appeared unchanged. The main interface routing toggle used a different code path that passed the value correctly. Upgrade to v3.16.2 for consistent messages in both locations.
- What should I do if routing or provider switching still fails after upgrading to the latest version?
- The reporter for #3947 said the issue persisted on the new version. The maintainer recommends providing the exact error text, provider (including whether a third-party API such as DeepSeek is connected), and version, and filing one issue per problem to help identify the cause.
- Can I enable Claude routing without a .claude folder?
- No. Route takeover needs to read the Claude configuration file; if it does not exist, the backend reports “Claude configuration file does not exist.” Run Claude Code once to generate the configuration, then enable routing.
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.