can1357/oh-my-pi · warning · AIError.OAuthError
Kimi device flow timed out
Error message
Kimi device flow timed out
What it means
Thrown when the Kimi device-authorization polling loop exhausts its maximum number of polls (or overall time budget) without the user completing authorization. The library classifies it as kind='timeout' because the flow simply never concluded — Kimi kept returning authorization_pending until the loop gave up. A new device code is required; the old one is expired.
Source
Thrown at packages/ai/src/registry/oauth/kimi.ts:269
provider: "kimi",
});
}
if (error === "access_denied") {
throw new AIError.OAuthError("Kimi device authorization denied", {
kind: "validation",
provider: "kimi",
});
}
const description = payload.error_description ? `: ${payload.error_description}` : "";
throw new AIError.OAuthError(`Kimi device flow failed: ${error ?? response.status}${description}`, {
kind: "polling",
provider: "kimi",
});
}
throw new AIError.OAuthError("Kimi device flow timed out", {
kind: "timeout",
provider: "kimi",
});
}
/**
* Login with Kimi Code OAuth (device code flow).
*/
export async function loginKimi(options: OAuthController): Promise<OAuthCredentials> {
const device = await requestDeviceAuthorization();
options.onAuth?.({
url: device.verificationUriComplete,
instructions: `Enter code: ${device.userCode}`,
});
return pollForToken(device.deviceCode, device.intervalMs, device.expiresInMs, options.signal);
}
View on GitHub (pinned to 9690622007)
Solutions
- Re-run loginKimi() and complete the browser authorization promptly
- Open the printed verification URL immediately and confirm the user_code matches
- Ensure you are approving in a browser where you are (or can) log in to the correct Kimi account
- If repeatedly timing out on a remote box, copy the URL to your local machine's browser
Example fix
null
Defensive patterns
Strategy: try-catch
Try / catch
try {
await loginKimi();
} catch (e) {
if (e instanceof AIError.OAuthError && e.kind === 'timeout') {
console.error('Timed out waiting for Kimi authorization — run login again and approve promptly.');
} else throw e;
} Prevention
- Open the verification URL immediately when printed
- Complete the flow in a browser already logged into the right Kimi account
- On headless machines, relay the URL to a browser you control before the poll budget expires
When it happens
Trigger: loginKimi() prints the verification URL and user_code, but the user never opens the page or never clicks approve before the poll loop reaches its max iterations/interval budget.
Common situations: User walks away and forgets to authorize; headless/SSH session where the URL isn't visible; user pastes the code into the wrong account or browser; Kimi's session expiry being shorter than the CLI's poll budget.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- Kimi device authorization denied
- Kimi device flow failed: ${error ?? response.status}${descri
- xAI device-code request failed: ${error instanceof Error ? e
- xAI device-code token polling failed: ${error instanceof Err
- Too many pending authorization requests. Please try again la
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/eeeedb7e14162610.
Report an issue: GitHub.