diegosouzapw/OmniRoute · error · ClaudeAuthFileError

Only Claude provider connections can export Claude auth…

Error message

Only Claude provider connections can export Claude auth files

What it means

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.

Solutions

  1. Pass the connectionId of an actual Claude connection
  2. Check for a copy/paste or routing bug that mapped the export request to the wrong connection
  3. Use the appropriate exporter for the connection's actual provider
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/lib/oauth/utils/claudeAuthFile.ts:181 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/8abe006bfee36809. Report an issue: GitHub.

Appendix: source

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

    payload.claudeAiOauth.subscriptionType = subscriptionType;
  }

  const rateLimitTier = toNonEmptyString(psd.rateLimitTier);
  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"
    );
  }

View on GitHub (pinned to a179ffed5b)