{"record":{"id":"55af0a08cb9f0e7e","repo":"Kuberwastaken/claurst","slug":"exchange-code-request-failed","errorCode":null,"errorMessage":"exchange_code: request failed: {}","messagePattern":"exchange_code: request failed: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-rust/crates/mcp/src/oauth.rs","lineNumber":486,"sourceCode":"    token_endpoint: &str,\n    code: &str,\n    verifier: &str,\n    redirect_uri: &str,\n) -> anyhow::Result<McpToken> {\n    let client = reqwest::Client::new();\n    let params = [\n        (\"grant_type\", \"authorization_code\"),\n        (\"code\", code),\n        (\"code_verifier\", verifier),\n        (\"redirect_uri\", redirect_uri),\n    ];\n\n    let resp = client\n        .post(token_endpoint)\n        .form(&params)\n        .send()\n        .await\n        .map_err(|e| anyhow::anyhow!(\"exchange_code: request failed: {}\", e))?;\n\n    if !resp.status().is_success() {\n        let status = resp.status();\n        let body = resp.text().await.unwrap_or_default();\n        anyhow::bail!(\"exchange_code: HTTP {} — {}\", status, body);\n    }\n\n    #[derive(serde::Deserialize)]\n    struct TokenResponse {\n        access_token: String,\n        refresh_token: Option<String>,\n        expires_in: Option<u64>,\n        scope: Option<String>,\n    }\n\n    let tr: TokenResponse = resp.json().await.map_err(|e| anyhow::anyhow!(\"exchange_code: bad JSON: {}\", e))?;\n\n    let expires_at = tr.expires_in.map(|secs| {","sourceCodeStart":468,"sourceCodeEnd":504,"githubUrl":"https://github.com/Kuberwastaken/claurst/blob/b0637c97ec34144387cbf2f74f65df6d16a6cef1/src-rust/crates/mcp/src/oauth.rs#L468-L504","documentation":"The HTTP POST to the OAuth token_endpoint (authorization-code grant with PKCE verifier) failed at the transport level — connection refused, DNS failure, TLS error, or timeout. The endpoint URL comes from the server's protected-resource metadata; no HTTP response was received.","triggerScenarios":"Thrown at src-rust/crates/mcp/src/oauth.rs:486 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify network connectivity and the token endpoint URL from the server's OAuth metadata","Check TLS/proxy configuration for the authorization server host","Retry the authentication flow after resolving the network issue"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b0637c97ec34144387cbf2f74f65df6d16a6cef1","analyzedAt":"2026-09-10T00:24:58.650Z","contentChangedAt":"2026-09-10T00:24:58.650Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}