zeroclaw-labs/zeroclaw · error

Email OAuth2 device-code flow timed out before authorization

Error message

Email OAuth2 device-code flow timed out before authorization

What it means

Error "Email OAuth2 device-code flow timed out before authorization" thrown in zeroclaw-labs/zeroclaw.

Source

Thrown at crates/zeroclaw-providers/src/auth/email_oauth2.rs:130

        expires_in: parsed.expires_in,
        interval: parsed.interval.unwrap_or(5).max(1),
        message: parsed.message,
    })
}

/// Poll the token endpoint until the user completes authorization or the flow expires.
pub async fn poll_device_code_tokens(
    client: &Client,
    token_url: &str,
    client_id: &str,
    device: &DeviceCodeStart,
) -> Result<TokenSet> {
    let started = Instant::now();
    let mut interval_secs = device.interval.max(1);

    loop {
        if started.elapsed() > Duration::from_secs(device.expires_in) {
            anyhow::bail!("Email OAuth2 device-code flow timed out before authorization");
        }

        tokio::time::sleep(Duration::from_secs(interval_secs)).await;

        let form: &[(&str, &str)] = &[
            ("grant_type", "urn:ietf:params:oauth:grant-type:device_code"),
            ("device_code", device.device_code.as_str()),
            ("client_id", client_id),
        ];

        let response = client
            .post(token_url)
            .form(form)
            .send()
            .await
            .context("Failed polling email OAuth2 token endpoint")?;

        if response.status().is_success() {

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Complete the device-code authorization promptly; restart the flow if it timed out.

When it happens

Trigger: Thrown at crates/zeroclaw-providers/src/auth/email_oauth2.rs:130 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/59af83a2f545253f. Report an issue: GitHub.