zeroclaw-labs/zeroclaw · error
Email OAuth2 token request failed
Error message
Email OAuth2 token request failed ({status}): {body} What it means
Raised in parse_token_response, shared by refresh_access_token and the device-code poller: the OAuth token endpoint responded with a non-2xx status. It fires only when the body did not first match a structured OAuthErrorResponse (the branch above it), so {body} is a raw, unclassified error body.
Solutions
- Check the token endpoint status/body; verify client credentials and the device code are still valid.
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at crates/zeroclaw-providers/src/auth/email_oauth2.rs:179 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23).
Data as JSON: /api/errors/4016b961e8b80de8.
Report an issue: GitHub.
Appendix: source
Thrown at crates/zeroclaw-providers/src/auth/email_oauth2.rs:179
}
"access_denied" => anyhow::bail!("Email OAuth2 authorization was denied"),
"expired_token" => anyhow::bail!("Email OAuth2 device-code expired"),
_ => anyhow::bail!(
"Email OAuth2 device-code polling failed ({status}): {}",
err.error_description.unwrap_or(err.error)
),
}
}
anyhow::bail!("Email OAuth2 device-code polling failed ({status}): {text}");
}
}
async fn parse_token_response(response: reqwest::Response) -> Result<TokenSet> {
if !response.status().is_success() {
let status = response.status();
let body = response.text().await.unwrap_or_default();
anyhow::bail!("Email OAuth2 token request failed ({status}): {body}");
}
let token: TokenResponse = response
.json()
.await
.context("Failed to parse email OAuth2 token response")?;
let expires_at = token.expires_in.and_then(|seconds| {
if seconds <= 0 {
None
} else {
Some(Utc::now() + chrono::Duration::seconds(seconds))
}
});
Ok(TokenSet {
access_token: token.access_token,
refresh_token: token.refresh_token,View on GitHub (pinned to 88bb9c8533)