BigPizzaV3/CodexPlusPlus · error

当前 Codex 配置使用外部 model_catalog_json,无法同时应用每模型窗口、自动压缩或元数据

Error message

当前 Codex 配置使用外部 model_catalog_json,无法同时应用每模型窗口、自动压缩或元数据

What it means

Same conflict as the in-config case but detected against the live home directory: if the Codex config references an external model catalog on disk (live_external_model_catalog) and per-model overrides are requested, the apply bails. The wording '当前 Codex 配置' distinguishes it from error 307, which fires on the pointer found inside the config text itself.

Solutions

  1. Delete or de-register the external catalog pointer (remove model_catalog_json from config.toml and/or the catalog file reference), then re-apply
  2. Or apply without per-model window/auto-compact/metadata overrides
  3. Fold the external catalog's model entries into model_windows and regenerate a managed catalog

Example fix

// before
$ rm not needed; instead config.toml still points to codex-models.json
model_catalog_json = "/home/user/.codex/codex-models.json"
// after
# remove the pointer, then run apply with model_windows
codex-plus apply --profile my-profile --model-windows deepseek-v4-pro=1M
Defensive patterns

Strategy: validation

Validate before calling

if !official_deepseek_responses && live_external_model_catalog(home).is_some() && has_per_model_overrides {
    return Err(anyhow::anyhow!("外部 catalog 与每模型覆盖冲突"));
}

Try / catch

match apply_relay_profile_to_home_with_switch_rules(...) {
    Err(e) if e.to_string().contains("外部 model_catalog_json") => offer_migrate_external_catalog_to_model_windows(),
    other => other?,
}

Prevention

When it happens

Trigger: Calling the apply pipeline with has_per_model_overrides == true while live_external_model_catalog(home) finds an external catalog (e.g. ~/.codex/codex-models.json referenced by config), and not in the official-deepseek-responses fast path.

Common situations: An external catalog file created by an earlier run or another tool still lives in ~/.codex; user applies per-model windows without realizing the external catalog pointer is still active.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


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

Appendix: source

Thrown at crates/codex-plus-core/src/relay_config.rs:2035

                        &existing,
                        &catalog_relative,
                        &entries,
                        fallback,
                    )?
                {
                    let mut doc = parse_toml_document(&config_text)?;
                    doc["model_catalog_json"] = toml_edit::value(catalog_relative);
                    return Ok(normalize_optional_toml(doc));
                }
                return Ok(config_text);
            }
        }
    }
    if !official_deepseek_responses
        && let Some(external_catalog) = live_external_model_catalog(home)
    {
        if has_per_model_overrides {
            anyhow::bail!(
                "当前 Codex 配置使用外部 model_catalog_json,无法同时应用每模型窗口、自动压缩或元数据"
            );
        }
        let mut doc = parse_toml_document(&config_text)?;
        if custom_responses
            && copy_standard_responses_catalog(
                home,
                &external_catalog,
                &catalog_relative,
                &entries,
                fallback,
            )?
        {
            doc["model_catalog_json"] = toml_edit::value(catalog_relative);
        } else {
            doc["model_catalog_json"] = toml_edit::value(external_catalog);
        }
        return Ok(normalize_optional_toml(doc));

View on GitHub (pinned to b1ed92e5e4)