ruvnet/ruflo · error · Error
Token refresh failed: ${response.status}
Error message
Token refresh failed: ${response.status} What it means
The token endpoint returned a non-2xx status for the refresh grant. The failed stored tokens are deleted (so stale credentials can't loop) and the HTTP status is surfaced — invalid/expired refresh token, revoked grant, or endpoint outage.
Source
Thrown at v3/@claude-flow/mcp/src/oauth.ts:244
if (this.config.clientSecret) {
params.set('client_secret', this.config.clientSecret);
}
const response = await fetch(this.config.tokenEndpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: params.toString(),
});
if (!response.ok) {
const error = await response.text();
this.logger.error('Token refresh failed', { status: response.status, error });
// Clear invalid tokens
await this.tokenStorage.delete(storageKey);
throw new Error(`Token refresh failed: ${response.status}`);
}
const data = (await response.json()) as TokenResponse;
const tokens = this.parseTokenResponse(data);
// Preserve refresh token if not returned in response
if (!tokens.refreshToken && existing.refreshToken) {
tokens.refreshToken = existing.refreshToken;
}
await this.tokenStorage.save(storageKey, tokens);
this.logger.info('Token refresh successful');
this.emit('tokens:refreshed', { expiresIn: tokens.expiresIn });
return tokens;
}
/**View on GitHub (pinned to fa13ee4ad6)
Solutions
- Inspect the status: 400/401 usually means the refresh token was revoked or expired; redo the login flow.
- Verify client_id/client_secret and token endpoint match the OAuth app configuration.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at v3/@claude-flow/mcp/src/oauth.ts:244 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18).
Data as JSON: /api/errors/893e1f3672e2b643.
Report an issue: GitHub.