{"record":{"id":"599a0f167e86def5","repo":"diegosouzapw/OmniRoute","slug":"codex-access-token-missing","errorCode":"codex_access_token_missing","errorMessage":"Codex OAuth access token is missing.","messagePattern":"Codex OAuth access token is missing\\.","errorType":"exception","errorClass":"CodexResetCreditError","httpStatus":401,"severity":"error","filePath":"src/lib/usage/codexResetCredits.ts","lineNumber":284,"sourceCode":"  if (!text) return {};\n  try {\n    return JSON.parse(text);\n  } catch {\n    return text;\n  }\n}\n\nfunction getWorkspaceId(connection: CodexConnectionLike): string | null {\n  const providerSpecificData = toRecord(connection.providerSpecificData);\n  const workspaceId = providerSpecificData.workspaceId;\n  return typeof workspaceId === \"string\" && workspaceId.trim().length > 0\n    ? workspaceId.trim()\n    : null;\n}\n\nfunction buildCodexResetCreditHeaders(connection: CodexConnectionLike): Record<string, string> {\n  if (!connection.accessToken) {\n    throw new CodexResetCreditError(\n      401,\n      \"codex_access_token_missing\",\n      \"Codex OAuth access token is missing.\"\n    );\n  }\n\n  const headers: Record<string, string> = {\n    Authorization: `Bearer ${connection.accessToken}`,\n    \"Content-Type\": \"application/json\",\n    Accept: \"application/json\",\n    // Canonical Codex backend identity (UA + originator + version), same\n    // chain as inference — see getCodexUsage.\n    ...getCodexBackendIdentityHeaders(),\n  };\n\n  const workspaceId = getWorkspaceId(connection);\n  if (workspaceId) headers[\"chatgpt-account-id\"] = workspaceId;\n","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/usage/codexResetCredits.ts#L266-L302","documentation":"Error \"Codex OAuth access token is missing.\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/usage/codexResetCredits.ts:284 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"}