{"record":{"id":"717ff4cb8b384cb1","repo":"musistudio/claude-code-router","slug":"kimi-cli-provider-configuration-was-not-found","errorCode":null,"errorMessage":"Kimi CLI provider configuration was not found.","messagePattern":"Kimi CLI provider configuration was not found\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/agents/local-providers/kimi.ts","lineNumber":137,"sourceCode":"    importable: false,\n    kind: \"kimi\",\n    modelDisplayNames: configured.modelDisplayNames,\n    modelMetadata: configured.modelMetadata,\n    models: configured.models,\n    name: configured.name,\n    protocol: configured.protocol,\n    sourceFile: auth?.sourceFile ?? configured.sourceFile,\n    status: \"locked\"\n  };\n}\n\nexport async function importKimiProvider(\n  candidate: LocalAgentProviderCandidate,\n  providerNames: string[]\n): Promise<LocalAgentProviderImportResult> {\n  const configured = readKimiConfiguredProviders().find((item) => item.candidateId === candidate.id);\n  if (!configured) {\n    throw new Error(\"Kimi CLI provider configuration was not found.\");\n  }\n  const usesOauth = Boolean(configured.oauthKey && !configured.apiKey);\n  const oauthReference = kimiOauthReference(configured);\n  const auth = usesOauth ? await resolveKimiAuth(oauthReference) : undefined;\n  const token = configured.apiKey || auth?.accessToken;\n  if (!token || (auth && kimiAccessTokenExpired(auth))) {\n    throw new Error(\"Kimi CLI credential was not found or is expired.\");\n  }\n  const nextCandidate: LocalAgentProviderCandidate = {\n    ...candidate,\n    modelDisplayNames: configured.modelDisplayNames,\n    modelMetadata: configured.modelMetadata,\n    models: configured.models,\n    protocol: configured.protocol\n  };\n  const provider = providerPayload(\n    nextCandidate,\n    uniqueProviderName(providerNames, configured.name),","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/musistudio/claude-code-router/blob/99f24806c6a2c660b16e53e95211c517448a6c90/packages/core/src/agents/local-providers/kimi.ts#L119-L155","documentation":"importKimiProvider looked up the persisted Kimi CLI provider configuration for a given candidate id and found no matching record. The import flow cannot proceed because model lists, credentials references, and metadata all come from that stored configuration.","triggerScenarios":"readKimiConfiguredProviders() returns entries whose candidateId does not match candidate.id — config file deleted/reset, candidate id changed between discovery and import, or config written by an incompatible older version.","commonSituations":"The Kimi CLI config file was cleared, migrated, or partially corrupted; the candidate list was rebuilt with new ids after a CLI upgrade; concurrent processes rewrote the config between discovery and import.","solutions":["Re-run Kimi CLI setup/login so the provider configuration is written again","Verify the config file exists and contains an entry whose candidateId matches the candidate being imported","If ids drifted after an upgrade, re-enumerate candidates so discovery and import use the same generation","Avoid editing the provider config by hand; use the CLI commands"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const configured = readKimiConfiguredProviders?.() ?? [];\nif (!configured.some(c => c.candidateId === candidate.id)) {\n  // re-run discovery/setup before calling importKimiProvider\n  await reinitializeKimi();\n}","typeGuard":null,"tryCatchPattern":"catch (e) {\n  if (e instanceof Error && e.message === 'Kimi CLI provider configuration was not found.') {\n    await rerunKimiSetup(); // regenerate config then retry import once\n  }\n}","preventionTips":["Run provider discovery and import in the same session to keep candidate ids stable","Don't hand-edit or delete the CLI's provider config file","Re-run setup after upgrading the Kimi CLI"],"tags":["kimi","config","provider-import","missing-config"],"backgroundTag":"provider-config-missing","analyzedSha":"99f24806c6a2c660b16e53e95211c517448a6c90","analyzedAt":"2026-08-27T04:11:01.184Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}