jdx/mise · error
GitHub device authorization expired
Error message
GitHub device authorization expired
What it means
During the OAuth device flow, GitHub issues a device code valid for a bounded window (typically ~15 minutes). `poll_access_token` loops until the deadline polling GitHub's token endpoint; if the deadline passes before the user completes authorization (and before any terminal error like `authorization_pending` expiry), mise aborts with this error.
Solutions
- Re-run `mise token github --oauth` and complete the authorization promptly at https://github.com/login/device
- Enter the one-time code immediately after it prints; do not wait between printing and entering
- Avoid suspending the machine during the flow; keep the terminal open until authorization completes
- If device flow is impractical, authenticate with a PAT via `GITHUB_TOKEN`/`MISE_GITHUB_TOKEN` instead
Defensive patterns
Strategy: retry
Try / catch
if let Err(e) = authorize().await {
if e.to_string().contains("device authorization expired") {
// restart the device flow; do not poll the same dead device code
authorize().await?;
} else { return Err(e); }
} Prevention
- Complete the github.com/login/device step as soon as the code is printed
- Keep the machine awake and the terminal open during the device flow
- Use a PAT in headless or unattended environments to skip the device flow entirely
When it happens
Trigger: Running `mise token github --oauth` and not visiting https://github.com/login/device and entering the code before the device code expires; sleeping/suspending the machine past the deadline; very long interval waits after GitHub slows polling.
Common situations: User walked away mid-login; copied the code too late; network slowness caused missed polling window; GitHub returned slow_down intervals that consumed the validity window; headless session where the instructions were never seen.
Understand the failure class
Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.
Related errors
- {details}
- GitHub device authorization was denied
- GitHub OAuth is configured for
- GitHub OAuth is not configured. Set github.oauth_client_id…
- GitHub OAuth token is not cached. Run `mise token github…
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/4155620bce6ecba1.
Report an issue: GitHub.
Appendix: source
Thrown at src/github/oauth.rs:329
.error_for_status()?
.json::<DeviceCodeResponse>()
.await?)
}
async fn poll_access_token(device: &DeviceCodeResponse) -> Result<TokenResponse> {
let settings = Settings::get();
let deadline = chrono::Utc::now() + chrono::Duration::seconds(device.expires_in as i64);
let mut interval = device.interval.max(1);
let url = format!(
"{}/oauth/access_token",
settings.github.oauth_auth_url.trim_end_matches('/')
);
let client_id = settings.github.oauth_client_id.trim();
let client = crate::http::HTTP.reqwest()?;
loop {
if chrono::Utc::now() >= deadline {
bail!("GitHub device authorization expired");
}
tokio::time::sleep(Duration::from_secs(interval)).await;
let response = match client
.post(&url)
.header("Accept", "application/json")
.form(&[
("client_id", client_id),
("device_code", device.device_code.as_str()),
("grant_type", GRANT_DEVICE_CODE),
])
.send()
.await
.and_then(|r| r.error_for_status())
{
Ok(resp) => match resp.json::<TokenResponse>().await {
Ok(body) => body,
Err(err) => {View on GitHub (pinned to 533346cc37)