BigPizzaV3/CodexPlusPlus · error

自定义数据库不存在:

Error message

自定义数据库不存在:{}

What it means

`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.

Solutions

  1. Create or restore the configured database file at the path shown in the message
  2. Fix the configured path in settings to point at the existing CCS database (use absolute paths)
  3. Rely on the built-in fallback: the resolver falls back to the default DB with a fallback_reason — verify that behavior is acceptable
  4. Run the tests' scenarios (falls back when custom database is missing) to confirm resolution logic

Example fix

// before
let custom_db_path = PathBuf::from(&configured_db_path); // may be relative
// after
let custom_db_path = std::env::current_dir()?.join(&configured_db_path);
if !custom_db_path.exists() {
    tracing::warn!("custom CCS database missing at {}, falling back to default", custom_db_path.display());
}
Defensive patterns

Strategy: fallback

Validate before calling

let db = PathBuf::from(&configured_db_path);
if !db.is_absolute() { /* resolve to absolute */ }
if !db.exists() {
    eprintln!("custom CCS DB missing: {}", db.display()); // fall back to default source
}

Try / catch

let source = resolve_codex_provider_source(&settings);
match source.fallback_reason {
    Some(reason) if reason.contains("自定义数据库不存在") => use_default_db(reason),
    _ => use(source),
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19). Data as JSON: /api/errors/263a0c14d998a6ce. Report an issue: GitHub.

Appendix: source

Thrown at crates/codex-plus-core/src/ccs_import.rs:64

    configured_db_path: &str,
    default_db_path: PathBuf,
) -> anyhow::Result<CcsProviderSource> {
    let configured_db_path = configured_db_path.trim().to_string();
    if configured_db_path.is_empty() {
        let providers = list_codex_providers_from_db(&default_db_path)?;
        return Ok(CcsProviderSource {
            configured_db_path,
            db_path: default_db_path,
            fallback_reason: None,
            providers,
        });
    }

    let custom_db_path = PathBuf::from(&configured_db_path);
    let custom_result = if custom_db_path.exists() {
        list_codex_providers_from_db(&custom_db_path)
    } else {
        Err(anyhow!("自定义数据库不存在:{}", custom_db_path.display()))
    };
    match custom_result {
        Ok(providers) => Ok(CcsProviderSource {
            configured_db_path,
            db_path: custom_db_path,
            fallback_reason: None,
            providers,
        }),
        Err(custom_error) => {
            let providers = list_codex_providers_from_db(&default_db_path).with_context(|| {
                format!(
                    "自定义数据库不可用({custom_error}),默认数据库 {} 也无法读取",
                    default_db_path.display()
                )
            })?;
            Ok(CcsProviderSource {
                configured_db_path,
                db_path: default_db_path,

View on GitHub (pinned to b1ed92e5e4)