openai/codex · error · anyhow::Error

ChatGPT account ID not available, please re-run codex login

Error message

ChatGPT account ID not available, please re-run codex login

What it means

Error "ChatGPT account ID not available, please re-run codex login" thrown in openai/codex.

Source

Thrown at codex-rs/chatgpt/src/chatgpt_client.rs:138

///
/// Callers that bind other state to the auth snapshot should pass that same snapshot here rather
/// than reacquiring auth while the request is in flight.
pub(crate) async fn chatgpt_post_request_with_timeout<
    TResponse: DeserializeOwned,
    TRequest: Serialize + ?Sized,
>(
    config: &Config,
    auth: &CodexAuth,
    path: String,
    body: &TRequest,
    timeout: Duration,
    product_sku: &str,
) -> anyhow::Result<TResponse> {
    anyhow::ensure!(
        auth.uses_codex_backend(),
        "ChatGPT backend requests require Codex backend auth"
    );
    anyhow::ensure!(
        auth.get_account_id().is_some(),
        "ChatGPT account ID not available, please re-run codex login"
    );

    let url = format!(
        "{}/{}",
        config.chatgpt_base_url.trim_end_matches('/'),
        path.trim_start_matches('/')
    );
    let http_client_factory = config.http_client_factory();
    let client = if http_client_factory.has_chatgpt_cookies() {
        psp_chatgpt_client(http_client_factory)
    } else {
        create_client()
    };
    let response = client
        .post(&url)
        .headers(default_headers())

View on GitHub (pinned to 339751715c)

When it happens

Trigger: Thrown at codex-rs/chatgpt/src/chatgpt_client.rs:138 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/5baa863f5b195cfa. Report an issue: GitHub.