zeroclaw-labs/zeroclaw · error
Google OAuth error
Error message
Google OAuth error: {} - {} What it means
Raised in exchange_code_for_tokens during the Gemini/Google OAuth code-for-token exchange with PKCE: the token endpoint returned non-2xx and the body parsed as an OAuthErrorResponse. The placeholders carry the structured error code and its error_description (defaulting to empty), giving the RFC 6749 reason the exchange was refused (for example invalid_grant).
Solutions
- Read the Google OAuth error code and description; fix client ID/secret or requested scopes accordingly.
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at crates/zeroclaw-providers/src/auth/gemini_oauth.rs:126 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/044f2ff5bec57723.
Report an issue: GitHub.
Appendix: source
Thrown at crates/zeroclaw-providers/src/auth/gemini_oauth.rs:126
("code_verifier", &pkce.code_verifier),
];
let response = client
.post(GOOGLE_OAUTH_TOKEN_URL)
.form(&form)
.send()
.await
.context("Failed to send token exchange request")?;
let status = response.status();
let body = response
.text()
.await
.context("Failed to read token response body")?;
if !status.is_success() {
if let Ok(err) = serde_json::from_str::<OAuthErrorResponse>(&body) {
anyhow::bail!(
"Google OAuth error: {} - {}",
err.error,
err.error_description.unwrap_or_default()
);
}
anyhow::bail!("Google OAuth token exchange failed ({}): {}", status, body);
}
let token_response: TokenResponse =
serde_json::from_str(&body).context("Failed to parse token response")?;
let expires_at = token_response
.expires_in
.map(|secs| Utc::now() + chrono::Duration::seconds(secs));
Ok(TokenSet {
access_token: token_response.access_token,
refresh_token: token_response.refresh_token,View on GitHub (pinned to 88bb9c8533)