{"record":{"id":"263a0c14d998a6ce","repo":"BigPizzaV3/CodexPlusPlus","slug":"ccs-import","errorCode":null,"errorMessage":"自定义数据库不存在：{}","messagePattern":"自定义数据库不存在：(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/ccs_import.rs","lineNumber":64,"sourceCode":"    configured_db_path: &str,\n    default_db_path: PathBuf,\n) -> anyhow::Result<CcsProviderSource> {\n    let configured_db_path = configured_db_path.trim().to_string();\n    if configured_db_path.is_empty() {\n        let providers = list_codex_providers_from_db(&default_db_path)?;\n        return Ok(CcsProviderSource {\n            configured_db_path,\n            db_path: default_db_path,\n            fallback_reason: None,\n            providers,\n        });\n    }\n\n    let custom_db_path = PathBuf::from(&configured_db_path);\n    let custom_result = if custom_db_path.exists() {\n        list_codex_providers_from_db(&custom_db_path)\n    } else {\n        Err(anyhow!(\"自定义数据库不存在：{}\", custom_db_path.display()))\n    };\n    match custom_result {\n        Ok(providers) => Ok(CcsProviderSource {\n            configured_db_path,\n            db_path: custom_db_path,\n            fallback_reason: None,\n            providers,\n        }),\n        Err(custom_error) => {\n            let providers = list_codex_providers_from_db(&default_db_path).with_context(|| {\n                format!(\n                    \"自定义数据库不可用（{custom_error}），默认数据库 {} 也无法读取\",\n                    default_db_path.display()\n                )\n            })?;\n            Ok(CcsProviderSource {\n                configured_db_path,\n                db_path: default_db_path,","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/ccs_import.rs#L46-L82","documentation":"`resolve_codex_provider_source_with_default` resolves where codex providers come from: a configured custom SQLite database or the default one. When the configured custom DB path does not exist on disk, it deliberately returns this error, which the resolver then converts into a fallback to the default source with a `fallback_reason`. The message includes the offending path.","triggerScenarios":"Calling `resolve_codex_provider_source` while settings point `configured_db_path` at a file that is absent — the `custom_db_path.exists()` check fails and `list_codex_providers_from_db` is never invoked.","commonSituations":"CCS database moved/deleted after configuration, path configured relative to a different working directory, sync/restore didn't recreate the DB file, or a typo in the configured path.","solutions":["Create or restore the configured database file at the path shown in the message","Fix the configured path in settings to point at the existing CCS database (use absolute paths)","Rely on the built-in fallback: the resolver falls back to the default DB with a fallback_reason — verify that behavior is acceptable","Run the tests' scenarios (falls back when custom database is missing) to confirm resolution logic"],"exampleFix":"// before\nlet custom_db_path = PathBuf::from(&configured_db_path); // may be relative\n// after\nlet custom_db_path = std::env::current_dir()?.join(&configured_db_path);\nif !custom_db_path.exists() {\n    tracing::warn!(\"custom CCS database missing at {}, falling back to default\", custom_db_path.display());\n}","handlingStrategy":"fallback","validationCode":"let db = PathBuf::from(&configured_db_path);\nif !db.is_absolute() { /* resolve to absolute */ }\nif !db.exists() {\n    eprintln!(\"custom CCS DB missing: {}\", db.display()); // fall back to default source\n}","typeGuard":null,"tryCatchPattern":"let source = resolve_codex_provider_source(&settings);\nmatch source.fallback_reason {\n    Some(reason) if reason.contains(\"自定义数据库不存在\") => use_default_db(reason),\n    _ => use(source),\n}","preventionTips":["Store absolute paths for the custom CCS database","Check `Path::exists` after any config change or restore","Recreate/restore the DB file when migrating machines"],"tags":["database","file-not-found","configuration","fallback"],"backgroundTag":"file-not-found","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}