Hmbown/CodeWhale · error

xAI OIDC discovery failed with HTTP {status}

Error message

xAI OIDC discovery failed with HTTP {status}

What it means

Raised in the xAI OIDC discovery helper when the HTTP GET to the issuer's /.well-known/openid-configuration endpoint returns a non-success status code. The response status is captured and reported verbatim; common causes are an unreachable or misconfigured issuer, a proxy returning an error page, or the issuer requiring auth for discovery.

Source

Thrown at crates/tui/src/xai_oauth.rs:1038

    let discovery_url = format!(
        "{}/.well-known/openid-configuration",
        issuer.trim_end_matches('/')
    );
    let client = crate::tls::reqwest_blocking_client_builder()
        .timeout(Duration::from_secs(20))
        .build()
        .context("Failed to build xAI OIDC discovery client")?;
    #[cfg(test)]
    crate::external_credentials::record_oauth_network();
    let response = client
        .get(&discovery_url)
        .header(reqwest::header::ACCEPT, "application/json")
        .send()
        .context("xAI OIDC discovery request failed")?;
    let (status, discovery): (_, OidcDiscoveryResponse) =
        parse_oauth_json_response(response, "xAI OIDC discovery")?;
    if !status.is_success() {
        bail!("xAI OIDC discovery failed with HTTP {status}");
    }
    validate_discovered_issuer(discovery.issuer, issuer)?;

    Ok(DeviceOauthEndpoints {
        device_authorization_endpoint: validate_discovered_oauth_endpoint(
            discovery.device_authorization_endpoint,
            "device_authorization_endpoint",
            issuer,
        )?,
        token_endpoint: validate_discovered_oauth_endpoint(
            discovery.token_endpoint,
            "token_endpoint",
            issuer,
        )?,
    })
}

fn validate_discovered_issuer(discovered: Option<String>, expected: &str) -> Result<()> {

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Verify the issuer URL is correct and reachable from this network
  2. Check the HTTP status: 404 suggests a wrong issuer path, 401/403 an auth-gated endpoint, 5xx a provider outage
  3. Retry after resolving network or proxy issues; inspect proxies if a captive portal intercepts the request
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at crates/tui/src/xai_oauth.rs:1038 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/89b2fc2332eea44b. Report an issue: GitHub.