BigPizzaV3/CodexPlusPlus · error · anyhow::Error

供应商配置总开关已关闭,未同步 live 配置

Error message

供应商配置总开关已关闭,未同步 live 配置

What it means

sync_active_relay_to_home bails out early when BackendSettings.relay_profiles_enabled is false. The relay-profile feature is a global opt-in switch; when it is off the function refuses to write any relay configuration into the live config.toml, so callers (the launch command) surface this as an error instead of silently doing nothing.

Solutions

  1. Enable the relay profiles master switch in the manager settings (set relay_profiles_enabled = true) and retry.
  2. If you do not need relay profiles, launch without the sync path / accept that live config is not modified.
  3. Check BackendSettings persistence for a stale/incorrect value of the flag.

Example fix

// before
"relay_profiles_enabled": false
// after (settings.toml / manager UI)
"relay_profiles_enabled": true
Defensive patterns

Strategy: validation

Validate before calling

if !settings.relay_profiles_enabled {
    // skip sync or prompt user to enable the switch before launching
    return Ok(()); // or surface a UI warning
}

Type guard

fn relay_sync_applicable(settings: &BackendSettings) -> bool {
    settings.relay_profiles_enabled
}

Prevention

When it happens

Trigger: Calling a launch/sync command whose settings have relay_profiles_enabled == false, while the code path expects the active relay profile to be synced to home.

Common situations: User disabled the relay-profiles master switch in manager settings but still triggers launch with a relay profile selected; fresh install where the flag was never enabled; settings migrated from a version without the flag defaulting to off.

Related errors


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

Appendix: source

Thrown at apps/codex-plus-manager/src-tauri/src/commands.rs:1012

fn restore_optional_file_bytes(path: &Path, contents: Option<&[u8]>) -> anyhow::Result<()> {
    match contents {
        Some(contents) => codex_plus_core::settings::atomic_write(path, contents)?,
        None => match std::fs::remove_file(path) {
            Ok(()) => {}
            Err(error) if error.kind() == std::io::ErrorKind::NotFound => {}
            Err(error) => return Err(error.into()),
        },
    }
    Ok(())
}

fn sync_active_relay_to_home(
    settings: &BackendSettings,
    home: &Path,
) -> anyhow::Result<codex_plus_core::relay_config::RelayApplyResult> {
    if !settings.relay_profiles_enabled {
        anyhow::bail!("供应商配置总开关已关闭,未同步 live 配置");
    }
    let relay = settings.active_relay_profile();
    if relay.relay_mode == codex_plus_core::settings::RelayMode::Aggregate {
        if settings.active_aggregate_relay_profile().is_none() {
            anyhow::bail!("当前聚合供应商配置不完整");
        }
        let aggregate = settings
            .active_aggregate_relay_profile()
            .ok_or_else(|| anyhow::anyhow!("当前聚合供应商配置不完整"))?;
        return codex_plus_core::relay_config::apply_relay_config_to_home_with_session_provider(
            home,
            &codex_plus_core::protocol_proxy::local_responses_proxy_base_url(
                codex_plus_core::protocol_proxy::protocol_proxy_port(),
            ),
            "codex-plus-aggregate",
            codex_plus_core::settings::RelayProtocol::Responses,
            codex_plus_core::protocol_proxy::protocol_proxy_port(),
            aggregate.session_provider,

View on GitHub (pinned to b1ed92e5e4)