--- title: CC Switch 切换中转站后 Codex 旧会话报 provider not found type: experience permalink: main/projects/211ab78b-753e-4017-8533-79ae2c92d218/cc-switch-切换中转站后-codex-旧会话报-provider-not-found stable_id: c14af6ad-2409-4223-a0d2-19de3201ae3d scope: project project_id: 211ab78b-753e-4017-8533-79ae2c92d218 memory_type: experience status: active revision: 1 restored_from_commit: 6a6a895eafcca6052e81a14fca103a42635dd1c2 created_at: '2026-09-23T14:51:43.142617+00:00' updated_at: '2026-09-23T14:51:43.142678+00:00' tags: - codex - cc-switch - config.toml - model-provider - troubleshooting --- 现象:Codex App 打开任意旧会话提示无法加载 config.toml,错误为历史会话引用的 model provider 不存在;切回 AICodings 正常。根因:旧会话及 state_5.sqlite/local_thread_catalog 持久化为 `aicodings-codex`,而其他 CC Switch 中转站只写入 `model_provider = "custom"` 和 `[model_providers.custom]`。config.toml 的 TOML 语法本身正常。修复:关闭 Codex/CC Switch,先完整备份;把活动及归档 JSONL 中结构化字段 `model_provider`/`model_provider_id` 从旧 ID 迁移为 `custom`,同步更新 `state_5.sqlite.threads.model_provider` 和 `sqlite/codex-dev.db.local_thread_catalog.model_provider`;把 AICodings 的 CC Switch 模板顶层 provider 也改为 `custom`;启用 `unifyCodexSessionHistory`。验证需检查所有历史 JSONL 可解析、SQLite integrity_check=ok、会话/目录库 provider 全为 custom、当前 config 的 provider 在 model_providers 中存在,并用 Codex CLI加载配置。不要仅添加临时 alias,因为 CC Switch 下次切换会重写 config.toml。