Kuberwastaken/claurst · error · anyhow::Error
No stored token for
Error message
No stored token for {} What it means
refresh_mcp_token looked up a stored token for the named MCP server and found none in the local token store. The caller (get_valid_mcp_token) reached the refresh path without an existing stored credential — the server was never authenticated, or its stored token was deleted/cleared.
Solutions
- Run the OAuth authentication flow for this MCP server first
- Check whether the token store was cleared or is pointing at a different location
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at src-rust/crates/mcp/src/oauth.rs:524 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/17076a8e81ecc866.
Report an issue: GitHub.
Appendix: source
Thrown at src-rust/crates/mcp/src/oauth.rs:524
.duration_since(std::time::UNIX_EPOCH)
.unwrap_or_default()
.as_secs()
+ secs
});
Ok(McpToken {
access_token: tr.access_token,
refresh_token: tr.refresh_token,
expires_at,
scope: tr.scope,
server_name: String::new(), // caller should set this
})
}
/// 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();View on GitHub (pinned to b0637c97ec)