diegosouzapw/OmniRoute · error · ClaudeAuthFileError
refresh_failed
refresh_failed
Error message
Failed to refresh the Claude session before exporting the credentials file. Re-authenticate this account if the session is stale.
What it means
Post-refresh failure in resolveFreshClaudeConnection: getAccessToken returned (recoverably) but with no accessToken — the session refresh produced no usable token. Unlike the unrecoverable-refresh branch (409 reauth_required), this means the refresh path itself failed to deliver a token; the error advises re-authenticating if the session is stale.
Solutions
- Retry the export once — transient refresh failures can yield empty results
- Inspect why getAccessToken returned without an accessToken (upstream 5xx, malformed token response)
- If the session is genuinely stale, re-authenticate the account and retry
- Avoid exporting a credentials.json with empty tokens
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at src/lib/oauth/utils/claudeAuthFile.ts:219 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/0abce2df9bfec81d.
Report an issue: GitHub.
Appendix: source
Thrown at src/lib/oauth/utils/claudeAuthFile.ts:219
const refreshed = await getAccessToken("claude", {
connectionId,
accessToken: connection.accessToken,
refreshToken,
expiresAt: connection.expiresAt,
expiresIn: connection.expiresIn,
providerSpecificData: connection.providerSpecificData,
});
if (isUnrecoverableRefreshError(refreshed)) {
throw new ClaudeAuthFileError(
"Claude refresh token is no longer valid. Re-authenticate this account before exporting.",
409,
"reauth_required"
);
}
if (!refreshed?.accessToken) {
throw new ClaudeAuthFileError(
"Failed to refresh the Claude session before exporting the credentials file. Re-authenticate this account if the session is stale.",
502,
"refresh_failed"
);
}
await updateProviderCredentials(connectionId, refreshed);
return {
...connection,
accessToken: refreshed.accessToken,
refreshToken: toNonEmptyString(refreshed.refreshToken) || refreshToken,
expiresIn:
typeof refreshed.expiresIn === "number" ? refreshed.expiresIn : connection.expiresIn || null,
expiresAt:
typeof refreshed.expiresIn === "number"
? new Date(Date.now() + refreshed.expiresIn * 1000).toISOString()
: connection.expiresAt || null,View on GitHub (pinned to a179ffed5b)