Troubleshooting

Atlas: xAI device code expired, denied, or timed out

Updated 6 min read

Atlas ends an xAI login with "xAI device code expired - please re-run login", "xAI device authorization was denied", or "xAI device authorization timed out" because the xAI plugin polls the device token endpoint and reports each outcome separately. The fix is to re-run atlas auth login for xai and complete the browser approval promptly. If you accidentally clicked deny, start a fresh device flow, and confirm the machine's clock is correct, because skew shortens the effective device-code lifetime.

Why does Atlas say xAI device code expired

Atlas says "xAI device code expired - please re-run login" because the xAI plugin polls the device token endpoint and the device code aged out before you approved it in the browser. The plugin reports expiry, denial, and timeout as 3 distinct messages, so expiry means the code itself lapsed.

Device codes are short-lived by design. The xAI plugin in Atlas issues one, then polls the device token endpoint waiting for you to approve in the browser. If the approval does not land in time, the code expires and Atlas tells you exactly that, with the instruction to re-run login. There is no way to revive an expired device code. Starting a fresh flow and approving without delay is the entire fix, and the phrasing of the message is deliberate: Atlas is naming the specific one of three possible outcomes rather than giving you a generic login failure.

xAI device authorization was denied: what to do

Atlas throws "xAI device authorization was denied" when the browser approval was explicitly rejected rather than left to expire. Denial is 1 of the 3 outcomes the xAI plugin distinguishes, and it is final, so if you clicked deny by accident you must start a fresh device flow.

Denial is distinct from expiry and from timeout, and the xAI plugin distinguishes all three deliberately. A denied authorization is a decision that has been recorded, so there is nothing left to wait for. Re-run `atlas auth login` for xai to issue a new device code, open the approval page again, and approve rather than deny. If the denial was not accidental, then the xAI account or the approval page is telling you something about access permissions, and re-running the flow will simply reproduce the denial.

xAI device authorization timed out: what it means

Atlas throws "xAI device authorization timed out" when the xAI plugin exhausted its polling window without a decision arriving from the device token endpoint. A timeout is the 3rd outcome the plugin models: no approval and no denial ever landed, which usually means the browser approval page was never completed.

The timeout is the third distinct outcome the xAI plugin models. Where expiry says the code lapsed and denial says the request was rejected, a timeout says Atlas stopped waiting. In practice they resolve the same way: re-run `atlas auth login` for xai and finish the browser approval promptly rather than leaving the tab open. If timeouts happen repeatedly even when you approve quickly, look at whether the polling requests to the device token endpoint are reaching xAI at all, since a blocked egress path produces a silent wait that ends in exactly this message.

Why the machine clock affects xAI device code expiry

Confirm the machine's clock is correct when xAI device codes expire in Atlas, because clock skew shortens the effective device-code lifetime. That check is step 3 of the 4 documented fix steps: a machine running ahead of real time treats a freshly issued device code as older than it is.

Clock skew is the cause people rarely check and it produces the most confusing version of this failure: you approve quickly, well inside what should be the window, and Atlas still reports "xAI device code expired - please re-run login". Fix the system time, ideally with network time synchronization, then re-run `atlas auth login` for xai. On a corporate or virtual machine that has been suspended and resumed, drifting clocks are common enough to be worth ruling out before anything else.

xAI device code request failed: a different error

Atlas throws "xAI device code request failed (<status>)" when the device code request itself fails, which is a different error from the 3 browser-side outcomes of expiry, denial, and timeout. That message points at network or credentials, because the flow never got as far as a browser approval.

Read the message you actually received before you start fixing. Expiry, denial, and timeout all describe what happened after a device code was issued and you were sent to the browser. "xAI device code request failed (<status>)" means no device code was ever issued, so re-approving faster will change nothing. The HTTP status in the parentheses is the lead: it tells you whether xAI rejected the request or whether it never arrived. Check egress to xAI and check the credentials the request was made with.

How to verify the xAI login fix worked

Verify the xAI login fix in Atlas by re-running `atlas auth login` for xai, approving in the browser, and confirming the flow completes with none of the 3 failure messages. Then select an xAI model and send a message to confirm the stored credentials actually work.

Completing the auth flow is necessary but not sufficient. Select an xAI model in Atlas afterwards and send a real message, because a login that reports success and a provider that answers are two separate facts. Atlas lets you switch the active model and provider on the fly with favorites and recents, so the check takes seconds. If a device code expires again on a repeat attempt despite a prompt approval, the clock is the next thing to verify rather than the flow itself.

How to fix it

  1. 01Re-run `atlas auth login` for xai and complete the browser approval promptly, before the device code expires.
  2. 02If you accidentally clicked deny, start a fresh device flow. A denied authorization cannot be reversed in place.
  3. 03Confirm the machine's clock is correct. Clock skew shortens the effective device-code lifetime and makes codes expire early.
  4. 04If the device code request itself fails, the message is: xAI device code request failed (<status>). That points at network or credentials rather than at anything you did in the browser.

Frequently asked questions

How do I fix xAI device code expired in Atlas
Re-run `atlas auth login` for xai and complete the browser approval promptly. An expired device code cannot be revived, so a fresh device flow is required.
What is the difference between xAI device code expired and timed out
Expired means the device code itself lapsed. "xAI device authorization timed out" means the xAI plugin exhausted its polling window with no approval or denial arriving. Atlas throws a different message for each.
I clicked deny on the xAI approval page by mistake
Start a fresh device flow with `atlas auth login` for xai. Atlas throws "xAI device authorization was denied" and treats the denial as final, so it cannot be reversed in place.
Why do my xAI device codes expire immediately
Check the machine's clock. Clock skew shortens the effective device-code lifetime, so a machine whose time is wrong will treat a fresh xAI device code as already old.
What does xAI device code request failed mean
"xAI device code request failed (<status>)" means no device code was issued at all. That points at network or credentials rather than at the browser approval, and the HTTP status names the rejection.
How does Atlas know whether xAI login expired, was denied, or timed out
The xAI plugin polls the device token endpoint and distinguishes an expired device code, an explicit denial, and exhausting the polling window, throwing a different message for each case.

Try Atlas in your terminal

The terminal-native AI coding agent. Free core, single binary.

Install Atlas

Related guides

Atlas with Devstral Small 2 24B (local via Ollama): the Agent-First Local Model in 2026

Devstral Small 2 24B is Mistral's agent-first local model: a 14GB Ollama download, 128K context, free self-hosted, and it runs on a 16GB GPU. Atlas setup and tradeoffs.

Atlas vs OpenHands: Terminal AI Coding Agents in 2026

Atlas and OpenHands comparison for 2026. Explore terminal-native TUI, self-hosting, code indexing, change review, and pricing models for AI coding agents.

Atlas with Llama 3.2 1B (local via Ollama): the 2026 offline small_model slot

Llama 3.2 1B (local via Ollama) in Atlas: a 1.3GB CPU-friendly pull with a 128,000 token window, Free (self-hosted), best wired to small_model, not model.

Atlas with Qwen2.5 14B Instruct in 2026: The Open-Weights Main Model Tier

Qwen2.5 14B Instruct drives Atlas at $0.35 per Mtok input and $1.40 per Mtok output, fits a single 24 GB GPU at 4-bit, and holds a real multi-file edit plan.

Atlas with GPT-5.4 nano: The $0.20 Background Model in 2026

GPT-5.4 nano is OpenAI's cheapest reasoning-capable model at $0.20 / $1.25 per Mtok with a 400K window. Built for the titles, summaries, and classification Atlas runs constantly.

Atlas with Codestral 22B (Ollama): 32K Context and a License Gate in 2026

Codestral 22B (Ollama) is Mistral's 13GB code model with a 32K context, fluent across many languages. Free (self-hosted), non-commercial license. Atlas setup for 2026.

Atlas with Mistral 7B v0.3 (Ollama): The Predictable Local Baseline in 2026

Run Atlas on Mistral 7B v0.3 (Ollama): a 4.4GB Apache 2.0 model with a 32K context, free self-hosted. Setup, tradeoffs, and when to pick a stronger coder.

Atlas with Claude Sonnet 4.6: The Build Agent Default in 2026

Claude Sonnet 4.6 drives Atlas at $3 per Mtok input, $15 per Mtok output on a 1M token window with 128K max output. Setup, cost math, and when Sonnet 5 wins.

Browse this resource hub