BigPizzaV3/CodexPlusPlus · error · anyhow::Error

未检测到 ChatGPT 登录状态,已停止同步 live 配置

Error message

未检测到 ChatGPT 登录状态,已停止同步 live 配置

What it means

The live config sync command checks the ChatGPT auth status of the codex home directory (auth.json) before applying relay configuration. If codex_plus_core::relay_config::chatgpt_auth_status_from_home reports the user is not authenticated, the sync is aborted with this bail to avoid writing live relay settings for an account that cannot use them.

Solutions

  1. Run `codex login` in the target CODEX_HOME so auth.json is created with valid ChatGPT tokens
  2. Verify auth.json exists and is non-expired in the home directory the manager uses
  3. Re-run the sync/apply command after login completes

Example fix

// before: applying while logged out
apply_live_config(home, ...);
// after: guard first
let auth = codex_plus_core::relay_config::chatgpt_auth_status_from_home(home);
if !auth.authenticated { eprintln!("run `codex login` first"); return; }
apply_live_config(home, ...);
Defensive patterns

Strategy: validation

Validate before calling

let auth = codex_plus_core::relay_config::chatgpt_auth_status_from_home(home);
if (!auth.authenticated) { /* prompt codex login */ }

Try / catch

match result { Err(e) if e.to_string().contains("未检测到 ChatGPT 登录状态") => prompt_login(), Err(e) => report(e), Ok(v) => v }

Prevention

When it happens

Trigger: Calling the sync-apply live config Tauri command (commands.rs, around line 1074) when chatgpt_auth_status_from_home(home).authenticated == false — i.e. auth.json is missing, invalid, expired, or contains no ChatGPT tokens.

Common situations: User never logged into ChatGPT via codex; user logged out or token refresh expired; CODEX_HOME points to a fresh/empty directory without auth.json; a partial cleanup removed auth.json while config.toml remains.

Related errors


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

Appendix: source

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

        );
        protocol = codex_plus_core::settings::RelayProtocol::Responses;
    }
    if relay.relay_mode == codex_plus_core::settings::RelayMode::PureApi {
        return codex_plus_core::relay_config::apply_pure_api_config_to_home_with_session_provider(
            home,
            &base_url,
            &relay.api_key,
            protocol,
            codex_plus_core::protocol_proxy::protocol_proxy_port(),
            codex_plus_core::relay_config::relay_session_provider_from_config(
                &relay.config_contents,
            ),
        );
    }

    let auth = codex_plus_core::relay_config::chatgpt_auth_status_from_home(home);
    if !auth.authenticated {
        anyhow::bail!("未检测到 ChatGPT 登录状态,已停止同步 live 配置");
    }
    codex_plus_core::relay_config::apply_relay_config_to_home_with_session_provider(
        home,
        &base_url,
        &relay.api_key,
        protocol,
        codex_plus_core::protocol_proxy::protocol_proxy_port(),
        codex_plus_core::relay_config::relay_session_provider_from_config(&relay.config_contents),
    )
}

fn spawn_codex_plus_launch(
    mut request: LaunchRequest,
    accepted_message: &str,
) -> CommandResult<Value> {
    // launcher 收到显式 --app-path 时不会回退自动探测(避免静默启动错误目录),
    // 所以这里先把明显无效的路径摘掉,让它走探测而不是永久失败(#1972)。
    let requested_app_path = request.app_path.trim().to_string();

View on GitHub (pinned to b1ed92e5e4)