openai/codex · error · anyhow::Error

OAuth login task was cancelled

Error message

OAuth login task was cancelled: {err}

What it means

Raised in the OAuth login flow's wait(): the oneshot channel carrying the login result was dropped before completion, meaning the task that was driving the browser-based OAuth login was cancelled (shutdown, timeout, or abort) — err is the RecvError describing the dropped sender.

Solutions

  1. Retry the OAuth login
  2. Check logs for why the login task was cancelled (shutdown or timeout)
  3. Ensure the login flow is not aborted while awaiting the browser callback
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at codex-rs/rmcp-client/src/perform_oauth_login.rs:394 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/1b9a9f6a4afab96f. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/rmcp-client/src/perform_oauth_login.rs:394

    fn new(authorization_url: String, completion: oneshot::Receiver<Result<()>>) -> Self {
        Self {
            authorization_url,
            completion,
        }
    }

    pub fn authorization_url(&self) -> &str {
        &self.authorization_url
    }

    pub fn into_parts(self) -> (String, oneshot::Receiver<Result<()>>) {
        (self.authorization_url, self.completion)
    }

    pub async fn wait(self) -> Result<()> {
        self.completion
            .await
            .map_err(|err| anyhow!("OAuth login task was cancelled: {err}"))?
    }
}

struct OauthLoginFlow {
    auth_url: String,
    oauth_state: OAuthState,
    authorization_server_issuer: Option<String>,
    rx: oneshot::Receiver<CallbackResult>,
    guard: CallbackServerGuard,
    server_name: String,
    server_url: String,
    store_mode: OAuthCredentialsStoreMode,
    keyring_backend_kind: AuthKeyringBackendKind,
    launch_browser: bool,
    timeout: Duration,
}

fn resolve_callback_port(callback_port: Option<u16>) -> Result<Option<u16>> {

View on GitHub (pinned to 339751715c)