diegosouzapw/OmniRoute · error · CodexDeviceFlowError

usercode_failed

usercode_failed

Error message

Failed to request device code (${res.status}): ${text}

What it means

Error "Failed to request device code (${res.status}): ${text}" thrown in diegosouzapw/OmniRoute.

Source

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

      body: JSON.stringify({ client_id: clientId }),
      signal,
    });
  } catch (e: any) {
    if (e?.name === "AbortError") throw new CodexDeviceFlowError("aborted", "Device flow aborted");
    throw new CodexDeviceFlowError("network", `Failed to reach OpenAI: ${e?.message || e}`);
  }

  if (res.status === 404) {
    throw new CodexDeviceFlowError(
      "device_disabled",
      "Device code login is not enabled for this account. Enable it in ChatGPT security settings (or ask your workspace admin), or use the localhost 'Adicionar' flow.",
      404
    );
  }

  if (!res.ok) {
    const text = await res.text().catch(() => "");
    throw new CodexDeviceFlowError(
      "usercode_failed",
      `Failed to request device code (${res.status}): ${text}`,
      res.status
    );
  }

  const data: any = await res.json();
  const userCode = data.user_code || data.usercode;
  if (!data.device_auth_id || !userCode) {
    throw new CodexDeviceFlowError(
      "usercode_failed",
      "Device code response missing device_auth_id or user_code"
    );
  }

  return {
    deviceAuthId: data.device_auth_id,
    userCode,

View on GitHub (pinned to a179ffed5b)

When it happens

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

Common situations: See trigger scenarios.


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