diegosouzapw/OmniRoute · error · ClaudeAuthFileError

Only OAuth Claude connections support credentials.json…

Error message

Only OAuth Claude connections support credentials.json export

What it means

Auth-type guard in resolveFreshClaudeConnection: the provider is 'claude' but authType is not 'oauth' (e.g. an API-key based connection). Only OAuth Claude connections carry the token pair needed for credentials.json export, so API-key connections are rejected.

Solutions

  1. Use an OAuth-authenticated Claude connection for credentials.json export
  2. Or export the API key through the API-key credential path instead
  3. Re-authenticate via OAuth if the account should be an OAuth connection
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/lib/oauth/utils/claudeAuthFile.ts:185 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/9280e9db485429c7. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/oauth/utils/claudeAuthFile.ts:185

  if (rateLimitTier) {
    payload.claudeAiOauth.rateLimitTier = rateLimitTier;
  }

  return payload;
}

async function resolveFreshClaudeConnection(connectionId: string): Promise<ClaudeConnectionLike> {
  const connection = (await getCachedProviderConnectionById(connectionId)) as ClaudeConnectionLike | null;
  if (!connection) {
    throw new ClaudeAuthFileError("Connection not found", 404, "not_found");
  }

  if (connection.provider !== "claude") {
    throw new ClaudeAuthFileError("Only Claude provider connections can export Claude auth files");
  }

  if (connection.authType !== "oauth") {
    throw new ClaudeAuthFileError("Only OAuth Claude connections support credentials.json export");
  }

  if (!shouldRefreshClaudeConnection(connection)) {
    return connection;
  }

  const refreshToken = toNonEmptyString(connection.refreshToken);
  if (!refreshToken) {
    throw new ClaudeAuthFileError(
      "Claude connection requires refresh but no refresh_token is available. Re-authenticate first.",
      409,
      "reauth_required"
    );
  }

  const refreshed = await getAccessToken("claude", {
    connectionId,
    accessToken: connection.accessToken,

View on GitHub (pinned to a179ffed5b)