Skip to content

Cannot import providers, cannot manage sessions - cc-switch

Quick fix

Upgrade cc-switch for jsonc config support. Under WSL2, clone the database to a local Windows path on a schedule to work around SQLite locking.

Error output
显示无法导入供应商,无法进行会话管理,无法识别到Token消耗。
English translation

It says providers cannot be imported, sessions cannot be managed, and token consumption is not detected.

Several situations cause this: 1. Incompatible config file format: when the OpenCode config file is opencode.jsonc, older cc-switch cannot parse it and the import fails (fixed in v3.15.0 and later). 2. WSL2 database path locking: running cc-switch on a Windows host, SQLite file locking over the WSL UNC network path does not follow the standard, so database locking is easy to trigger and session and token data in WSL2 cannot be read. 3. Sync mechanism limits: some device-level parameters are not synced automatically when you edit the global config by hand or restore over WebDAV.

  1. Upgrade cc-switch to v3.15.0 or newer for native support importing and writing back opencode.jsonc format config.

  2. If you run OpenCode under WSL2 on Windows, set up a scheduled task inside WSL that clones ~/.local/share/opencode/opencode.db one way to a local path on the Windows host, working around SQLite UNC path locking.

Toolcc-switch
Version3.14.1 - 3.16.5
PlatformsWindowsmacOSLinux
Why did some settings not sync after restoring a WebDAV backup?
That is deliberate. What did not sync is classified as device-level parameters; cloud sync mainly syncs provider-related data.
I edited opencode.json by hand — why did cc-switch not sync the config automatically?
cc-switch does not watch for external hand edits in real time. Re-import or refresh inside the app.
Why can the database still not be read when I point at the WSL UNC path from Windows directly?
Windows reaches WSL over a UNC network path, and SQLite readily triggers database locking or file corruption on such paths. The only compromise today is cloning the database to a local Windows path on a schedule.

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.