decolua/9router · error

No active credentials for provider: ${provider}

Error message

No active credentials for provider: ${provider}

What it means

getProviderCredentials found no usable accounts for the provider and excludeConnectionIds is empty, meaning not a single credential (API key/OAuth account) is configured or currently active for that provider. The handler returns 404 'No active credentials for provider: <provider>'.

Source

Thrown at src/sse/handlers/chat.js:240

  // Try with available accounts (fallback on errors)
  const excludeConnectionIds = new Set();
  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(() => { });
      }
    }

View on GitHub (pinned to 90b52e06ff)

Solutions

  1. Open the 9Router dashboard → Credentials and add or reconnect an account for the named provider.
  2. Re-enable disabled accounts for that provider (they show as disconnected/inactive).
  3. If it's an OAuth provider, complete the OAuth login flow so a token is stored.
  4. Switch the model to a provider you actually have credentials for.

Example fix

// before
{ "model": "kiro/claude-sonnet-4" }   // no kiro account linked

// after: link a kiro account in the dashboard first, or use
{ "model": "openai/gpt-4o" }          // provider with an active key
Defensive patterns

Strategy: fallback

Validate before calling

const creds = await fetch(`${base}/dashboard/api/credentials`).then(r => r.json());
if (!creds.some(c => c.provider === provider && c.active)) {
  throw new Error(`No active credential for ${provider}; connect one in the dashboard first`);
}

Type guard

null

Try / catch

const res = await fetch(url, opts);
if (res.status === 404 && (await res.text()).includes('No active credentials')) {
  return useFallbackProvider(request); // e.g. switch model to a provider you have set up
}

Prevention

When it happens

Trigger: POST /v1/chat/completions with a model whose provider has zero credentials configured in the gateway, or whose accounts are all disabled/disconnected (e.g. OAuth session never linked).

Common situations: Fresh install where the provider was never connected in the dashboard; OAuth account logged out / token revoked and account disabled; credentials deleted during config cleanup; pointing the client at a provider name that exists in the registry but was never set up.

Related errors


AI-assisted analysis of decolua/9router@90b52e06ff (2026-08-30). Data as JSON: /api/errors/89860c0cc0fc7085. Report an issue: GitHub.