farion1231 / farion1231/cc-switch

Codex 备份 TOML 非法转义导致 cc-switch 操作失败

Open
#4,100 1 comment 0 reactions 0 assignees View on GitHub
bug stale
Dominant language
Rust
Stars
133k
Forks
9.2k
Avg merge
3d 20h
Merged PRs (30d)
48

Description

### Self Checks / 自检

- [x] I have read the [FAQ](https://github.com/farion1231/cc-switch#faq) section in README.
我已阅读 README 中的[常见问题](https://github.com/farion1231/cc-switch#常见问题)。

- [x] I have searched for [existing issues](https://github.com/farion1231/cc-switch/issues), including closed ones.
我已搜索过[已有的 Issue](https://github.com/farion1231/cc-switch/issues),包括已关闭的。

### CC Switch Version / 版本号

v3.16.2

### Operating System / 操作系统

Windows

### Related App / 涉及应用

Other / 其他

### Steps to Reproduce / 重现步骤

## 报错
```
解析现有 Codex 备份失败: TOML parse error at line 36, column 16
| command = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
| ^ invalid escape sequence
```

## 根因

cc-switch 数据库 `cc-switch.db` 中保存的 codex 配置副本里,playwright MCP 的路径使用了 **TOML 双引号字符串 + 未转义的 Windows 反斜杠**:

```toml
[mcp_servers]
[mcp_servers.playwright]
type = "stdio"
command = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
```

TOML 双引号字符串中 `\W`、`\v`、`\U`、`\.` 是非法转义序列,解析必然失败。受影响的记录:

| 位置 | 说明 |
|---|---|
| `proxy_live_backup` rowid=6 (codex, 2026-06-09 备份) | 代理接管时的 Live 配置备份,恢复/解析备份时直接报错 |

注意:当前 live 的 [config.toml](C:\Users\*\.codex\config.toml) 本身是好的(第 49 行用的是单引号字面量),坏的只是数据库里的副本。推测是claude编辑mcp时写入,cc-switch 存储时未做 TOML 校验。

### Expected Behavior / 期望行为

Bug Report

### Actual Behavior / 实际行为

_No response_

### Additional Context / 补充信息

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by tracing how the Codex backup is read from cc-switch.db and how config.toml content is serialized or validated; the report identifies the malformed Windows path in the playwright MCP backup as the reproduction case. Done means the affected backup no longer makes cc-switch operations fail and valid TOML can be parsed successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases, desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.