openai/codex · error · OAuthHttpClientAdapterError

OAuth HTTP request timed out

Error message

OAuth HTTP request timed out

What it means

Variant of OAuthHttpClientAdapterError: an OAuth discovery/registration HTTP request issued through the adapter did not complete before its timeout, so the authorization-server metadata fetch failed. This is a sentinel error, not a detailed network diagnostic.

Solutions

  1. Retry the OAuth discovery request
  2. Check network connectivity and authorization server availability
  3. Increase the discovery timeout (OAuthDiscoveryTimeout) if the server is slow
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at codex-rs/rmcp-client/src/oauth_http_client.rs:45 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


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

Appendix: source

Thrown at codex-rs/rmcp-client/src/oauth_http_client.rs:45

use rmcp::transport::auth::OAuthHttpClientFuture;
use rmcp::transport::auth::OAuthHttpRedirectPolicy;
use rmcp::transport::auth::OAuthHttpRequest;
use url::Origin;
use url::Url;

use crate::auth_status::OAuthDiscoveryTimeout;
use crate::http_client_adapter::StreamableHttpRedirectMode;
use crate::utils::MCP_USER_AGENT;

const MAX_OAUTH_HTTP_RESPONSE_BODY_BYTES: usize = 1024 * 1024;
const MAX_OAUTH_HTTP_REDIRECTS: usize = 10;
static NEXT_OAUTH_REQUEST_ID: AtomicU64 = AtomicU64::new(0);

#[derive(Debug, thiserror::Error)]
enum OAuthHttpClientAdapterError {
    #[error("unsupported OAuth HTTP redirect policy")]
    UnsupportedRedirectPolicy,
    #[error("OAuth HTTP request timed out")]
    TimedOut,
    #[error("OAuth HTTP request exceeded {MAX_OAUTH_HTTP_REDIRECTS} redirects")]
    TooManyRedirects,
    #[error("OAuth HTTP response body exceeds {maximum_bytes} bytes")]
    ResponseBodyTooLarge { maximum_bytes: usize },
    #[error("OAuth authorization server issuer does not match authorization metadata origin")]
    AuthorizationMetadataIssuerOriginMismatch,
}

fn oauth_http_client_error(
    error: impl std::error::Error + Send + Sync + 'static,
) -> OAuthHttpClientError {
    Box::new(error)
}

#[derive(Clone)]
pub(crate) struct OAuthHttpClientAdapter {
    http_client: Arc<dyn HttpClient>,

View on GitHub (pinned to 339751715c)