{"record":{"id":"0ac8c731d008beaa","repo":"Kuberwastaken/claurst","slug":"token-for-has-no-refresh-token","errorCode":null,"errorMessage":"Token for {} has no refresh token","messagePattern":"Token for (.+?) has no refresh token","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-rust/crates/mcp/src/oauth.rs","lineNumber":528,"sourceCode":"    });\n\n    Ok(McpToken {\n        access_token: tr.access_token,\n        refresh_token: tr.refresh_token,\n        expires_at,\n        scope: tr.scope,\n        server_name: String::new(), // caller should set this\n    })\n}\n\n/// Refresh an existing MCP token using the stored refresh token.\npub async fn refresh_mcp_token(server_name: &str, token_endpoint: &str) -> anyhow::Result<McpToken> {\n    let existing = get_mcp_token(server_name)\n        .ok_or_else(|| anyhow::anyhow!(\"No stored token for {}\", server_name))?;\n    let refresh = existing\n        .refresh_token\n        .as_deref()\n        .ok_or_else(|| anyhow::anyhow!(\"Token for {} has no refresh token\", server_name))?\n        .to_string();\n\n    let client = reqwest::Client::new();\n    let params = [(\"grant_type\", \"refresh_token\"), (\"refresh_token\", refresh.as_str())];\n\n    let resp = client\n        .post(token_endpoint)\n        .form(&params)\n        .send()\n        .await\n        .map_err(|e| anyhow::anyhow!(\"refresh: 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!(\"refresh: HTTP {} — {}\", status, body);\n    }\n","sourceCodeStart":510,"sourceCodeEnd":546,"githubUrl":"https://github.com/Kuberwastaken/claurst/blob/b0637c97ec34144387cbf2f74f65df6d16a6cef1/src-rust/crates/mcp/src/oauth.rs#L510-L546","documentation":"A stored token exists for the server but has no refresh_token field — the authorization server issued an access token only (no offline scope/grant). When the access token expires, it cannot be refreshed and the error surfaces from refresh_mcp_token.","triggerScenarios":"Thrown at src-rust/crates/mcp/src/oauth.rs:528 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-authenticate and request offline access / refresh-token scope if the server supports it","If the server never issues refresh tokens, expect to re-authenticate when the access token expires"],"exampleFix":null,"handlingStrategy":"fallback","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"}