diegosouzapw/OmniRoute · error · ClaudeAuthFileError
not_found
not_found
Error message
Connection not found
What it means
resolveFreshClaudeConnection lookup miss: getCachedProviderConnectionById returned null for the supplied connectionId. A 404 not_found — the id does not correspond to any stored provider connection (deleted, wrong id, or cache not yet primed with a fresh write).
Solutions
- Verify the connectionId exists in the provider connections list
- If the connection was recently created, ensure the cache is refreshed before export
- Treat as 404 in the API response with a clear 'connection not found' body
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/lib/oauth/utils/claudeAuthFile.ts:177 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
Background: NOT_FOUND error code: why tRPC, Harbor, Nacos and other libraries return 404 "not found" errors for resources that may still exist — this error's family across 11 libraries.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/32c883735dc027f9.
Report an issue: GitHub.
Appendix: source
Thrown at src/lib/oauth/utils/claudeAuthFile.ts:177
};
const subscriptionType = toNonEmptyString(psd.subscriptionType);
if (subscriptionType) {
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.",View on GitHub (pinned to a179ffed5b)