{"record":{"id":"89b2fc2332eea44b","repo":"Hmbown/CodeWhale","slug":"xai-oidc-discovery-failed-with-http-status","errorCode":null,"errorMessage":"xAI OIDC discovery failed with HTTP {status}","messagePattern":"xAI OIDC discovery failed with HTTP (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/xai_oauth.rs","lineNumber":1038,"sourceCode":"    let discovery_url = format!(\n        \"{}/.well-known/openid-configuration\",\n        issuer.trim_end_matches('/')\n    );\n    let client = crate::tls::reqwest_blocking_client_builder()\n        .timeout(Duration::from_secs(20))\n        .build()\n        .context(\"Failed to build xAI OIDC discovery client\")?;\n    #[cfg(test)]\n    crate::external_credentials::record_oauth_network();\n    let response = client\n        .get(&discovery_url)\n        .header(reqwest::header::ACCEPT, \"application/json\")\n        .send()\n        .context(\"xAI OIDC discovery request failed\")?;\n    let (status, discovery): (_, OidcDiscoveryResponse) =\n        parse_oauth_json_response(response, \"xAI OIDC discovery\")?;\n    if !status.is_success() {\n        bail!(\"xAI OIDC discovery failed with HTTP {status}\");\n    }\n    validate_discovered_issuer(discovery.issuer, issuer)?;\n\n    Ok(DeviceOauthEndpoints {\n        device_authorization_endpoint: validate_discovered_oauth_endpoint(\n            discovery.device_authorization_endpoint,\n            \"device_authorization_endpoint\",\n            issuer,\n        )?,\n        token_endpoint: validate_discovered_oauth_endpoint(\n            discovery.token_endpoint,\n            \"token_endpoint\",\n            issuer,\n        )?,\n    })\n}\n\nfn validate_discovered_issuer(discovered: Option<String>, expected: &str) -> Result<()> {","sourceCodeStart":1020,"sourceCodeEnd":1056,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/xai_oauth.rs#L1020-L1056","documentation":"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.","triggerScenarios":"Thrown at crates/tui/src/xai_oauth.rs:1038 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the issuer URL is correct and reachable from this network","Check the HTTP status: 404 suggests a wrong issuer path, 401/403 an auth-gated endpoint, 5xx a provider outage","Retry after resolving network or proxy issues; inspect proxies if a captive portal intercepts the request"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}