HKUDS/nanobot · error · RuntimeError
GitHub device code expired. Please run login again.
Error message
GitHub device code expired. Please run login again.
What it means
Raised in login_github_copilot's GitHub device-flow polling loop: GitHub returned error=expired_token, meaning the short-lived device code shown to the user timed out before the user completed authorization in the browser. The login attempt must restart from a fresh device code.
Solutions
- Re-run nanobot provider login github-copilot to get a new device code
- Enter the code in the browser promptly after it is displayed
- Avoid starting login and then waiting long before authorizing
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at nanobot/providers/github_copilot_provider.py:141 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of HKUDS/nanobot@42f37dc4c0 (2026-08-26).
Data as JSON: /api/errors/5e7a93fb79037bc3.
Report an issue: GitHub.
Appendix: source
Thrown at nanobot/providers/github_copilot_provider.py:141
)
poll.raise_for_status()
poll_payload = poll.json()
access_token = poll_payload.get("access_token")
if access_token:
token_expires_in = int(poll_payload.get("expires_in") or _LONG_LIVED_TOKEN_SECONDS)
break
error = poll_payload.get("error")
if error == "authorization_pending":
time.sleep(current_interval)
continue
if error == "slow_down":
current_interval += 5
time.sleep(current_interval)
continue
if error == "expired_token":
raise RuntimeError("GitHub device code expired. Please run login again.")
if error == "access_denied":
raise RuntimeError("GitHub device flow was denied.")
if error:
desc = poll_payload.get("error_description") or error
raise RuntimeError(str(desc))
time.sleep(current_interval)
else:
raise RuntimeError("GitHub device flow timed out.")
user = client.get(
user_url,
headers={
"Authorization": f"Bearer {access_token}",
"Accept": "application/vnd.github+json",
"User-Agent": USER_AGENT,
},
)
user.raise_for_status()View on GitHub (pinned to 42f37dc4c0)