zed-industries/zed · error

GitHub device-code request failed: {}

Error message

GitHub device-code request failed: {}

What it means

request_device_code POSTs client_id and scope to GitHub's device-code endpoint to begin Copilot Chat sign-in; this error wraps a non-success response, meaning GitHub refused to issue a device code (the message includes the status).

Source

Thrown at crates/copilot_chat/src/copilot_oauth.rs:73

/// Begins a device-code authorization by requesting a user code from GitHub.
pub async fn request_device_code(
    client: &Arc<dyn HttpClient>,
    configuration: &CopilotChatConfiguration,
) -> Result<DeviceFlow> {
    let body = form_encode(&[
        ("client_id", GITHUB_COPILOT_CLIENT_ID),
        ("scope", DEVICE_CODE_SCOPE),
    ]);

    let request = HttpRequest::builder()
        .method(Method::POST)
        .uri(configuration.device_code_url())
        .header("Accept", "application/json")
        .header("Content-Type", "application/x-www-form-urlencoded")
        .body(AsyncBody::from(body))?;

    let mut response = client.send(request).await?;
    anyhow::ensure!(
        response.status().is_success(),
        "GitHub device-code request failed: {}",
        response.status()
    );

    let mut body = Vec::new();
    response.body_mut().read_to_end(&mut body).await?;
    let parsed: DeviceCodeResponse =
        serde_json::from_slice(&body).context("Failed to parse GitHub device-code response")?;

    Ok(DeviceFlow {
        user_code: parsed.user_code,
        verification_uri: parsed.verification_uri,
        device_code: parsed.device_code,
        interval: parsed.interval.max(1),
    })
}

View on GitHub (pinned to f4178619ac)

Solutions

  1. Check GitHub's status and network connectivity
  2. Inspect the returned status/body for scope or client_id issues
  3. Retry the sign-in attempt after the cause is resolved
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at crates/copilot_chat/src/copilot_oauth.rs:73 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/74f3e17f0047a504. Report an issue: GitHub.