decolua/9router · error
All accounts unavailable
Error message
All accounts unavailable
What it means
There were credentials for the provider, but the account-selection loop exhausted them all (excludeConnectionIds non-empty) without finding a usable one. The handler returns lastStatus (or 503) with lastError, defaulting the message to 'All accounts unavailable'.
Source
Thrown at src/sse/handlers/chat.js:243
let lastError = null;
let lastStatus = null;
while (true) {
const credentials = await getProviderCredentials(provider, excludeConnectionIds, model);
// All accounts unavailable
if (!credentials || credentials.allRateLimited) {
if (credentials?.allRateLimited) {
const errorMsg = lastError || credentials.lastError || "Unavailable";
const status = lastStatus || Number(credentials.lastErrorCode) || HTTP_STATUS.SERVICE_UNAVAILABLE;
log.warn("CHAT", `[${provider}/${model}] ${errorMsg} (${credentials.retryAfterHuman})`);
return unavailableResponse(status, `[${provider}/${model}] ${errorMsg}`, credentials.retryAfter, credentials.retryAfterHuman);
}
if (excludeConnectionIds.size === 0) {
log.warn("AUTH", `No active credentials for provider: ${provider}`);
return errorResponse(HTTP_STATUS.NOT_FOUND, `No active credentials for provider: ${provider}`);
}
log.warn("CHAT", "No more accounts available", { provider });
return errorResponse(lastStatus || HTTP_STATUS.SERVICE_UNAVAILABLE, lastError || "All accounts unavailable");
}
// Account selection shown in the unified "▶" line (acc:...)
const refreshedCredentials = await checkAndRefreshToken(provider, credentials);
// Ensure real project ID is available for providers that need it (P0 fix: cold miss)
if ((provider === "antigravity" || provider === "gemini-cli") && !refreshedCredentials.projectId) {
const pid = await getProjectIdForConnection(credentials.connectionId, refreshedCredentials.accessToken, provider);
if (pid) {
refreshedCredentials.projectId = pid;
// Persist to DB in background so subsequent requests have it immediately
updateProviderCredentials(credentials.connectionId, { projectId: pid }).catch(() => { });
}
}
// Use shared chatCore
const chatSettings = await getSettings();View on GitHub (pinned to 90b52e06ff)
Solutions
- Check the dashboard log for lastError to see why each account failed; fix the root cause per account (re-auth, new key).
- Re-authenticate OAuth accounts whose tokens expired/revoked; replace invalid API keys.
- Add a healthy provider account or configure combo fallback to other providers.
- If an account was marked unavailable, clear its error state (clearAccountError) after fixing credentials and retry.
Example fix
// before
// all provider accounts invalid; client blindly retries the same model
{ "model": "cursor/gpt-4o" }
// after
// fix/re-auth accounts in dashboard, or add fallback combo
{ "model": "my-combo" } // combo: cursor/gpt-4o, openai/gpt-4o Defensive patterns
Strategy: fallback
Validate before calling
const creds = await fetch(`${base}/dashboard/api/credentials`).then(r => r.json());
const healthy = creds.filter(c => c.provider === provider && c.active && !c.lastError);
if (healthy.length === 0) throw new Error(`all ${provider} accounts unhealthy; fix or use another provider`); Type guard
null
Try / catch
const res = await fetch(url, opts);
const text = await res.text();
if (res.status >= 500 && text.includes('All accounts unavailable')) {
// fail over to another provider/model rather than retrying the same one
return requestVia(fallbackModel, request);
} Prevention
- Monitor per-account lastError in the dashboard and fix root causes promptly.
- Keep at least one healthy account per critical provider.
- Use combos with cross-provider fallback.
- Alert on repeated 'No more accounts available' log lines.
When it happens
Trigger: POST /v1/chat/completions where each of the provider's accounts was tried and excluded during this request (auth failures, per-account errors), and after the loop none remain, so the last upstream error/status is returned.
Common situations: Multiple accounts all with expired/invalid API keys; OAuth refresh tokens revoked on every account; per-account upstream errors (quota, suspension) across the whole pool; a combo whose member models map to providers that are all down.
Related errors
- No active credentials for provider: ${provider}
- [AutoPing] ${provider}:${connection.id}: ping failed (reset
- Kiro tool input changed fragment type
- Upstream returned empty audio
- Upstream error (${res.status})
AI-assisted analysis of decolua/9router@90b52e06ff (2026-08-30).
Data as JSON: /api/errors/2c7f9e5f3f9ed24c.
Report an issue: GitHub.