{"record":{"id":"c4521bd6d0ad41da","repo":"diegosouzapw/OmniRoute","slug":"missing-id-token","errorCode":"missing_id_token","errorMessage":"id_token is missing or empty in the auth.json","messagePattern":"id_token is missing or empty in the auth\\.json","errorType":"exception","errorClass":"CodexAuthFileError","httpStatus":400,"severity":"error","filePath":"src/lib/oauth/utils/codexAuthImport.ts","lineNumber":132,"sourceCode":"  const doc = toRecord(raw);\n\n  // Codex CLI no longer writes auth_mode in auth.json (only OmniRoute's own export\n  // includes it). Accept both formats as long as the required tokens are present.\n  if (doc.auth_mode !== undefined && doc.auth_mode !== null && doc.auth_mode !== \"chatgpt\") {\n    throw new CodexAuthFileError(\n      \"Not a Codex auth.json — unexpected auth_mode value\",\n      400,\n      \"invalid_auth_file\"\n    );\n  }\n\n  const tokens = toRecord(doc.tokens);\n  const idToken = toNonEmptyString(tokens.id_token);\n  const accessToken = toNonEmptyString(tokens.access_token);\n  const refreshToken = toNonEmptyString(tokens.refresh_token);\n\n  if (!idToken) {\n    throw new CodexAuthFileError(\n      \"id_token is missing or empty in the auth.json\",\n      400,\n      \"missing_id_token\"\n    );\n  }\n\n  if (!accessToken) {\n    throw new CodexAuthFileError(\n      \"access_token is missing or empty in the auth.json\",\n      400,\n      \"missing_access_token\"\n    );\n  }\n\n  if (!refreshToken) {\n    throw new CodexAuthFileError(\n      \"refresh_token is missing or empty in the auth.json\",\n      400,","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/oauth/utils/codexAuthImport.ts#L114-L150","documentation":"Validation step in parseAndValidateCodexAuth: doc.tokens.id_token is absent or empty. The id_token is required to derive the ChatGPT account id and expiry, so the file cannot be imported as a Codex OAuth connection.","triggerScenarios":"Thrown at src/lib/oauth/utils/codexAuthImport.ts:132 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-run 'codex login' to generate a complete auth.json with all three tokens","Check that the file being imported is the CLI's auth.json and not a partial/truncated copy","Re-export from OmniRoute if the source file came from an earlier export"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}