{"record":{"id":"001ae2f3f2926baa","repo":"decolua/9router","slug":"unknown-provider-name","errorCode":null,"errorMessage":"`Unknown provider: ${name}`","messagePattern":"`Unknown provider: (.+?)`","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/lib/oauth/providers/index.js","lineNumber":69,"sourceCode":"  trae,\n  windsurf,\n  zed,\n};\n\nexport { PROVIDERS };\n\n// Re-export helpers that other files import from this path\nexport { extractCodexAccountInfo, fetchKiroProfileArn };\n\n/**\n * Get provider handler\n */\nexport function getProvider(name) {\n  // Legacy kimi-coding → kimi (dual-auth merge)\n  const key = name === \"kimi-coding\" ? \"kimi\" : name;\n  const provider = PROVIDERS[key];\n  if (!provider) {\n    throw new Error(`Unknown provider: ${name}`);\n  }\n  return provider;\n}\n\n/**\n * Get all provider names\n */\nexport function getProviderNames() {\n  return Object.keys(PROVIDERS);\n}\n\n/**\n * Generate auth data for a provider\n * @param {object} [meta] - Provider-specific metadata (e.g. gitlab clientId/baseUrl)\n */\nexport async function generateAuthData(providerName, redirectUri, meta) {\n  const provider = getProvider(providerName);\n  const config = provider.prepareConfig","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/decolua/9router/blob/90b52e06ffd666b7929554211474d01588f6b1f8/src/lib/oauth/providers/index.js#L51-L87","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Log the exact name and compare against getProviderNames() output (the PROVIDERS keys) to spot typos or casing","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)","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","Update stored connections/config that reference the removed provider to a currently supported one"],"exampleFix":"// before\nawait generateAuthData('kilcode', redirectUri) // throws Unknown provider: kilocode\n// after\nimport { getProviderNames } from '@/lib/oauth/providers/index.js';\nconst name = 'kilocode';\nif (!getProviderNames().includes(name)) throw new Error(`Unsupported provider: ${name}`);\nawait generateAuthData(name, redirectUri);","handlingStrategy":"validation","validationCode":"import { getProviderNames } from '@/lib/oauth/providers/index.js';\nfunction isValidProvider(name) {\n  const key = name === 'kimi-coding' ? 'kimi' : name;\n  return typeof key === 'string' && getProviderNames().includes(key);\n}\n// call before any OAuth API: if (!isValidProvider(name)) fail fast with your own message","typeGuard":"function isKnownProvider(name) {\n  return typeof name === 'string' && getProviderNames().includes(name === 'kimi-coding' ? 'kimi' : name);\n}","tryCatchPattern":"try {\n  const provider = getProvider(userSuppliedName);\n} catch (e) {\n  if (e.message.startsWith('Unknown provider:')) {\n    return res.status(400).json({ error: `Unsupported provider \"${userSuppliedName}\"`, supported: getProviderNames() });\n  }\n  throw e;\n}","preventionTips":["Validate provider names against getProviderNames() at every API boundary before dispatching","Never build provider names from free-text user input; use a dropdown/enum of registry keys","When renaming/removing a provider, add a legacy alias in getProvider like kimi-coding→kimi and migrate stored connections","Keep provider id casing exactly as registered (all lowercase)"],"tags":["oauth","provider-registry","invalid-argument"],"backgroundTag":"unknown-provider","analyzedSha":"90b52e06ffd666b7929554211474d01588f6b1f8","analyzedAt":"2026-08-30T21:05:45.952Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}