diegosouzapw/OmniRoute · error · CodexDeviceFlowError

timeout

timeout

Error message

Authorization timed out. Start a new session.

What it means

Error "Authorization timed out. Start a new session." thrown in diegosouzapw/OmniRoute.

Source

Thrown at src/lib/oauth/codexDeviceFlow.ts:201

/**
 * Step 2 — poll until the user authorizes. Returns the authorization_code and the
 * server-generated code_verifier needed for the token exchange.
 */
export async function pollForAuthorization(
  deviceAuthId: string,
  userCode: string,
  intervalSec: number,
  opts: { signal?: AbortSignal; timeoutMs?: number } = {}
): Promise<{ authorizationCode: string; codeVerifier: string }> {
  const { signal, timeoutMs = DEFAULT_TIMEOUT_MS } = opts;
  const deadline = startMonotonic() + timeoutMs;

  while (true) {
    throwIfAborted(signal);
    await delay(intervalSec * 1000, signal);

    if (startMonotonic() >= deadline) {
      throw new CodexDeviceFlowError("timeout", "Authorization timed out. Start a new session.");
    }

    let res: Response;
    try {
      res = await fetch(`${API_BASE_URL}/deviceauth/token`, {
        method: "POST",
        headers: { "Content-Type": "application/json", Accept: "application/json" },
        body: JSON.stringify({ device_auth_id: deviceAuthId, user_code: userCode }),
        signal,
      });
    } catch (e: any) {
      if (e?.name === "AbortError")
        throw new CodexDeviceFlowError("aborted", "Device flow aborted");
      // Transient network error — keep polling until the deadline.
      continue;
    }

    if (res.ok) {

View on GitHub (pinned to a179ffed5b)

When it happens

Trigger: Thrown at src/lib/oauth/codexDeviceFlow.ts:201 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/da9854eb3614ae02. Report an issue: GitHub.