{"record":{"id":"80839b0530c71871","repo":"diegosouzapw/OmniRoute","slug":"usercode-failed","errorCode":"usercode_failed","errorMessage":"Failed to request device code (${res.status}): ${text}","messagePattern":"Failed to request device code \\((.+?)\\): (.+?)","errorType":"exception","errorClass":"CodexDeviceFlowError","httpStatus":null,"severity":"error","filePath":"src/lib/oauth/codexDeviceFlow.ts","lineNumber":159,"sourceCode":"      body: JSON.stringify({ client_id: clientId }),\n      signal,\n    });\n  } catch (e: any) {\n    if (e?.name === \"AbortError\") throw new CodexDeviceFlowError(\"aborted\", \"Device flow aborted\");\n    throw new CodexDeviceFlowError(\"network\", `Failed to reach OpenAI: ${e?.message || e}`);\n  }\n\n  if (res.status === 404) {\n    throw new CodexDeviceFlowError(\n      \"device_disabled\",\n      \"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.\",\n      404\n    );\n  }\n\n  if (!res.ok) {\n    const text = await res.text().catch(() => \"\");\n    throw new CodexDeviceFlowError(\n      \"usercode_failed\",\n      `Failed to request device code (${res.status}): ${text}`,\n      res.status\n    );\n  }\n\n  const data: any = await res.json();\n  const userCode = data.user_code || data.usercode;\n  if (!data.device_auth_id || !userCode) {\n    throw new CodexDeviceFlowError(\n      \"usercode_failed\",\n      \"Device code response missing device_auth_id or user_code\"\n    );\n  }\n\n  return {\n    deviceAuthId: data.device_auth_id,\n    userCode,","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/oauth/codexDeviceFlow.ts#L141-L177","documentation":"Error \"Failed to request device code (${res.status}): ${text}\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/oauth/codexDeviceFlow.ts:159 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}