{"record":{"id":"3bbb4bae680f25bf","repo":"diegosouzapw/OmniRoute","slug":"missing-refresh-token-3bbb4b","errorCode":"missing_refresh_token","errorMessage":"refreshToken is missing or empty in claudeAiOauth","messagePattern":"refreshToken is missing or empty in claudeAiOauth","errorType":"exception","errorClass":"ClaudeAuthFileError","httpStatus":400,"severity":"error","filePath":"src/lib/oauth/utils/claudeAuthImport.ts","lineNumber":66,"sourceCode":"// ──── Parse & validate ────────────────────────────────────────────────────────\n\nexport function parseAndValidateClaudeAuth(raw: unknown): ParsedClaudeAuth {\n  const doc = toRecord(raw);\n  const oauthBlock = toRecord(doc.claudeAiOauth);\n\n  const accessToken = toNonEmptyString(oauthBlock.accessToken);\n  const refreshToken = toNonEmptyString(oauthBlock.refreshToken);\n\n  if (!accessToken) {\n    throw new ClaudeAuthFileError(\n      \"accessToken is missing or empty in claudeAiOauth\",\n      400,\n      \"missing_access_token\"\n    );\n  }\n\n  if (!refreshToken) {\n    throw new ClaudeAuthFileError(\n      \"refreshToken is missing or empty in claudeAiOauth\",\n      400,\n      \"missing_refresh_token\"\n    );\n  }\n\n  // expiresAt in the file is ms epoch; store as ISO in DB\n  let expiresAt: string | null = null;\n  const rawExpiresAt = oauthBlock.expiresAt;\n  if (typeof rawExpiresAt === \"number\" && Number.isFinite(rawExpiresAt)) {\n    expiresAt = new Date(rawExpiresAt).toISOString();\n  } else if (typeof rawExpiresAt === \"string\" && rawExpiresAt.trim()) {\n    expiresAt = rawExpiresAt.trim();\n  }\n\n  const rawScopes = oauthBlock.scopes;\n  const scopes: string[] = Array.isArray(rawScopes)\n    ? rawScopes.filter((s): s is string => typeof s === \"string\")","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/oauth/utils/claudeAuthImport.ts#L48-L84","documentation":"Error \"refreshToken is missing or empty in claudeAiOauth\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/oauth/utils/claudeAuthImport.ts:66 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"}