decolua/9router · error · Error

`Unknown provider: ${name}`

Error message

`Unknown provider: ${name}`

What it means

getProvider(name) looks up a provider handler in the static PROVIDERS registry in src/lib/oauth/providers/index.js (claude, codex, xai, kiro, cursor, kimi, kilocode, etc.). It only aliases the legacy name 'kimi-coding' to 'kimi'; any other name not present in the registry object causes this throw. The library throws it early so unknown/typo'd provider names fail fast before any OAuth flow starts.

Source

Thrown at src/lib/oauth/providers/index.js:69

  trae,
  windsurf,
  zed,
};

export { PROVIDERS };

// Re-export helpers that other files import from this path
export { extractCodexAccountInfo, fetchKiroProfileArn };

/**
 * Get provider handler
 */
export function getProvider(name) {
  // Legacy kimi-coding → kimi (dual-auth merge)
  const key = name === "kimi-coding" ? "kimi" : name;
  const provider = PROVIDERS[key];
  if (!provider) {
    throw new Error(`Unknown provider: ${name}`);
  }
  return provider;
}

/**
 * Get all provider names
 */
export function getProviderNames() {
  return Object.keys(PROVIDERS);
}

/**
 * Generate auth data for a provider
 * @param {object} [meta] - Provider-specific metadata (e.g. gitlab clientId/baseUrl)
 */
export async function generateAuthData(providerName, redirectUri, meta) {
  const provider = getProvider(providerName);
  const config = provider.prepareConfig

View on GitHub (pinned to 90b52e06ff)

Solutions

  1. Log the exact name and compare against getProviderNames() output (the PROVIDERS keys) to spot typos or casing
  2. Fix the caller to pass a valid registry key (claude, codex, xai, grok-cli, gemini-cli, antigravity, iflow, qoder, github, kiro, cursor, kimi, kilocode, cline, clinepass, gitlab, codebuddy-cn, codebuddy-intl, kimchi, trae, windsurf, zed)
  3. If a legacy name is required, add an alias like the existing kimi-coding→kimi mapping in getProvider, or re-export the provider module and register it in the PROVIDERS object
  4. Update stored connections/config that reference the removed provider to a currently supported one

Example fix

// before
await generateAuthData('kilcode', redirectUri) // throws Unknown provider: kilocode
// after
import { getProviderNames } from '@/lib/oauth/providers/index.js';
const name = 'kilocode';
if (!getProviderNames().includes(name)) throw new Error(`Unsupported provider: ${name}`);
await generateAuthData(name, redirectUri);
Defensive patterns

Strategy: validation

Validate before calling

import { getProviderNames } from '@/lib/oauth/providers/index.js';
function isValidProvider(name) {
  const key = name === 'kimi-coding' ? 'kimi' : name;
  return typeof key === 'string' && getProviderNames().includes(key);
}
// call before any OAuth API: if (!isValidProvider(name)) fail fast with your own message

Type guard

function isKnownProvider(name) {
  return typeof name === 'string' && getProviderNames().includes(name === 'kimi-coding' ? 'kimi' : name);
}

Try / catch

try {
  const provider = getProvider(userSuppliedName);
} catch (e) {
  if (e.message.startsWith('Unknown provider:')) {
    return res.status(400).json({ error: `Unsupported provider "${userSuppliedName}"`, supported: getProviderNames() });
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling getProvider (directly or via generateAuthData/exchangeTokens/requestDeviceCode/pollForToken) with a provider name string that is not a key of PROVIDERS — e.g. typos ('kilcode', 'claude-code'), stale/renamed providers ('kimi-coding' is mapped, but other legacy names are not), user-supplied data from the OAuth start API, or providers removed between versions.

Common situations: Dashboard/API client sending an unlisted provider id to /api/oauth endpoints; older tooling referencing a provider that was renamed or dropped; case-sensitivity mistakes ('Claude' vs 'claude'); custom integrations assuming a provider exists when it is not compiled into the registry index.

Related errors


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