Skip to content

JSON parse error: expected value at line 1 - cc-switch

Quick fix

Upgrade cc-switch to fix JSON corruption from concurrent writes, and add custom fields to general config so a switch cannot overwrite them.

Error output
JSON 解析错误: C:\Users\soham\.gemini\settings.json: expected value at line 1 column 1
English translation

JSON parse error: C:\Users\soham\.gemini\settings.json: expected value at line 1 column 1

When switching or adding a provider in cc-switch, a concurrent failover or hot switch can leave the UI state out of sync with `settings.json`, or even corrupt the file to empty, producing a JSON parse error. Separately, cc-switch overwrites the target app's `settings.json` wholesale from a snapshot by default, silently discarding non-provider custom fields such as `tui` and `hooks`.

v3.13.0 fixed the state confusion from concurrency and hardened JSON parse tolerance, but the wholesale overwrite that loses custom fields remains (in v3.18.0, a lost `tui` makes Claude Code go full screen). You have to inject the fields you need to keep through the general config feature.

  1. Upgrade cc-switch to v3.13.0 or newer to fix the `settings.json` state confusion and JSON parse error from concurrent switching.

  2. For custom fields such as `tui` and `hooks` being overwritten on a switch, add the JSON fragment you need to keep under 通用配置 (general config) at the top left of the cc-switch UI.

    // cc-switch 通用配置
    {
    "tui": "default"
    }
Toolcc-switch
Version3.12.3 - 3.18.0
PlatformsWindows
The JSON parse error persists after upgrading to v3.13.0. What now?
Check whether `settings.json` was corrupted to an empty file, and restore it by hand if so. If it still errors, reopen the issue with logs.
Adding or switching provider loses my custom hooks, tui, and similar config. What now?
cc-switch overwrites the config file wholesale. Put the general config fragments you need to keep into 通用配置 (general config) so they are written back quickly.
Could there be an option to hide the tray icon, or fix duplicate tray icons?
Duplicate icons from reopening on Windows is a known bug under repair, and a minimise-to-tray toggle is planned for settings in future.

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.