Kuberwastaken/claurst · error · anyhow::Error
refresh: request failed
Error message
refresh: request failed: {} What it means
The HTTP POST for the refresh_token grant failed at the transport level — connection error, DNS failure, TLS problem, or timeout while contacting the token endpoint. No HTTP response was received; the network request itself failed.
Solutions
- Check connectivity to the token endpoint host
- Inspect proxy/TLS settings for the authorization server
- Retry once the network issue is resolved
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at src-rust/crates/mcp/src/oauth.rs:539 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Kuberwastaken/claurst@b0637c97ec (2026-09-10).
Data as JSON: /api/errors/f027d3e2209244e7.
Report an issue: GitHub.
Appendix: source
Thrown at src-rust/crates/mcp/src/oauth.rs:539
/// Refresh an existing MCP token using the stored refresh token.
pub async fn refresh_mcp_token(server_name: &str, token_endpoint: &str) -> anyhow::Result<McpToken> {
let existing = get_mcp_token(server_name)
.ok_or_else(|| anyhow::anyhow!("No stored token for {}", server_name))?;
let refresh = existing
.refresh_token
.as_deref()
.ok_or_else(|| anyhow::anyhow!("Token for {} has no refresh token", server_name))?
.to_string();
let client = reqwest::Client::new();
let params = [("grant_type", "refresh_token"), ("refresh_token", refresh.as_str())];
let resp = client
.post(token_endpoint)
.form(¶ms)
.send()
.await
.map_err(|e| anyhow::anyhow!("refresh: request failed: {}", e))?;
if !resp.status().is_success() {
let status = resp.status();
let body = resp.text().await.unwrap_or_default();
anyhow::bail!("refresh: HTTP {} — {}", status, body);
}
#[derive(serde::Deserialize)]
struct TokenResponse {
access_token: String,
refresh_token: Option<String>,
expires_in: Option<u64>,
}
let tr: TokenResponse = resp.json().await?;
let expires_at = tr.expires_in.map(|s| {
std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)View on GitHub (pinned to b0637c97ec)