musistudio/claude-code-router · error · Error
Kimi CLI OAuth token refresh timed out after ${kimiOauthRefr
Error message
Kimi CLI OAuth token refresh timed out after ${kimiOauthRefreshTimeoutMs}ms. What it means
The Kimi OAuth refresh HTTP request exceeded kimiOauthRefreshTimeoutMs and was aborted via AbortController. The request may be slow or the network hanging.
Source
Thrown at packages/core/src/agents/local-providers/kimi.ts:447
const refreshToken = readString(payload?.refresh_token) || readString(payload?.refreshToken);
const expiresIn = numberValue(payload?.expires_in) ?? numberValue(payload?.expiresIn);
if (!accessToken || !refreshToken || !expiresIn) {
throw new Error("Kimi CLI OAuth token refresh returned an incomplete token response.");
}
const refreshed: KimiTokenSet = {
...auth,
accessToken,
expiresAt: Math.floor(Date.now() / 1000) + expiresIn,
expiresIn,
refreshToken,
scope: readString(payload?.scope) || auth.scope || "",
tokenType: readString(payload?.token_type) || readString(payload?.tokenType) || "Bearer"
};
persistKimiAuth(refreshed);
return refreshed;
} catch (error) {
if (error instanceof Error && error.name === "AbortError") {
throw new Error(`Kimi CLI OAuth token refresh timed out after ${kimiOauthRefreshTimeoutMs}ms.`);
}
throw error;
} finally {
clearTimeout(timer);
}
}
function persistKimiAuth(auth: KimiTokenSet): void {
if (!auth.accessToken || !auth.refreshToken) {
return;
}
const payload = {
access_token: auth.accessToken,
refresh_token: auth.refreshToken,
expires_at: auth.expiresAt ?? 0,
scope: auth.scope ?? "",
token_type: auth.tokenType ?? "Bearer",
expires_in: auth.expiresIn ?? 0View on GitHub (pinned to 99f24806c6)
Solutions
- Verify network connectivity to the Kimi auth domain.
- Retry — transient slowness often resolves.
- Check if a proxy env var (HTTPS_PROXY) points at a dead proxy.
- Raise kimiOauthRefreshTimeoutMs if on a legitimately slow link.
Defensive patterns
Strategy: retry
Try / catch
try { await refreshKimiAuth(auth); } catch (e) { if (/timed out/.test(String((e as Error).message))) await sleep(backoff()); else throw e; } Prevention
- Set sane proxy env vars.
- Retry with exponential backoff on timeouts.
When it happens
Trigger: fetch in refreshKimiAuth does not settle before the setTimeout fires, the abort triggers AbortError, which is rethrown as this timeout error.
Common situations: Slow/blocked network, firewall dropping packets silently, DNS hang, or an overloaded auth endpoint.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- Grok CLI OAuth token refresh timed out after ${timeoutMs}ms.
- Kimi CLI refresh token was not found.
- Kimi CLI OAuth token refresh returned HTTP ${response.status
- Kimi CLI OAuth token refresh returned an incomplete token re
- Timed out waiting for ChatGPT response: + requestId
AI-assisted analysis of musistudio/claude-code-router@99f24806c6 (2026-08-27).
Data as JSON: /api/errors/c048e14030e25659.
Report an issue: GitHub.