{"record":{"id":"8abe006bfee36809","repo":"diegosouzapw/OmniRoute","slug":"only-claude-provider-connections-can-export-claude","errorCode":null,"errorMessage":"Only Claude provider connections can export Claude auth files","messagePattern":"Only Claude provider connections can export Claude auth files","errorType":"exception","errorClass":"ClaudeAuthFileError","httpStatus":null,"severity":"error","filePath":"src/lib/oauth/utils/claudeAuthFile.ts","lineNumber":181,"sourceCode":"    payload.claudeAiOauth.subscriptionType = subscriptionType;\n  }\n\n  const rateLimitTier = toNonEmptyString(psd.rateLimitTier);\n  if (rateLimitTier) {\n    payload.claudeAiOauth.rateLimitTier = rateLimitTier;\n  }\n\n  return payload;\n}\n\nasync function resolveFreshClaudeConnection(connectionId: string): Promise<ClaudeConnectionLike> {\n  const connection = (await getCachedProviderConnectionById(connectionId)) as ClaudeConnectionLike | null;\n  if (!connection) {\n    throw new ClaudeAuthFileError(\"Connection not found\", 404, \"not_found\");\n  }\n\n  if (connection.provider !== \"claude\") {\n    throw new ClaudeAuthFileError(\"Only Claude provider connections can export Claude auth files\");\n  }\n\n  if (connection.authType !== \"oauth\") {\n    throw new ClaudeAuthFileError(\"Only OAuth Claude connections support credentials.json export\");\n  }\n\n  if (!shouldRefreshClaudeConnection(connection)) {\n    return connection;\n  }\n\n  const refreshToken = toNonEmptyString(connection.refreshToken);\n  if (!refreshToken) {\n    throw new ClaudeAuthFileError(\n      \"Claude connection requires refresh but no refresh_token is available. Re-authenticate first.\",\n      409,\n      \"reauth_required\"\n    );\n  }","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/oauth/utils/claudeAuthFile.ts#L163-L199","documentation":"Provider mismatch guard in resolveFreshClaudeConnection: the connectionId resolved to a real connection, but its provider field is not 'claude'. Claude credentials.json export is only valid for Claude connections, so the request is refused rather than exporting another provider's tokens in Claude format.","triggerScenarios":"Thrown at src/lib/oauth/utils/claudeAuthFile.ts:181 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass the connectionId of an actual Claude connection","Check for a copy/paste or routing bug that mapped the export request to the wrong connection","Use the appropriate exporter for the connection's actual provider"],"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"}