openai/codex · error · anyhow::Error

OAuth credential loading task failed

Error message

OAuth credential loading task failed: {error}

What it means

The background task responsible for loading OAuth tokens from the keyring/store failed (JoinError, e.g. panic or cancellation), so credentials could not be read. The failing input is the spawned loading task itself, not the stored tokens.

Solutions

  1. Retry the connection so token loading is spawned again
  2. Check logs for the underlying panic/cancellation inside the credential loading task
  3. Verify keyring availability if the task consistently fails
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at codex-rs/rmcp-client/src/rmcp_client.rs:1089 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/02e44f7fce4fa00d. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/rmcp-client/src/rmcp_client.rs:1089

                                    // first concrete source so Auto is not reevaluated mid-client.
                                    pinned_credential_store.set(resolved.store).map_err(|_| {
                                        anyhow!(
                                            "OAuth credential store pinned concurrently for MCP server `{oauth_server_name}`"
                                        )
                                    })?;
                                }
                                Ok(tokens)
                            }
                            Err(err) => {
                                warn!(
                                    "failed to read tokens for server `{oauth_server_name}`: {err}"
                                );
                                Ok(None)
                            }
                        }
                    })
                    .await
                    .map_err(|error| anyhow!("OAuth credential loading task failed: {error}"))??
                } else {
                    None
                };

                if let Some(ResolvedOAuthTokens {
                    tokens: initial_tokens,
                    store: credential_store,
                }) = resolved_oauth_tokens
                {
                    match create_oauth_transport_and_runtime(
                        server_name,
                        url,
                        initial_tokens.clone(),
                        credential_store,
                        default_headers.clone(),
                        Arc::clone(http_client),
                        has_configured_headers,
                        *redirect_mode,

View on GitHub (pinned to 339751715c)