musistudio/claude-code-router · error · Error

Kimi CLI provider configuration was not found.

Error message

Kimi CLI provider configuration was not found.

What it means

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.

Source

Thrown at packages/core/src/agents/local-providers/kimi.ts:137

    importable: false,
    kind: "kimi",
    modelDisplayNames: configured.modelDisplayNames,
    modelMetadata: configured.modelMetadata,
    models: configured.models,
    name: configured.name,
    protocol: configured.protocol,
    sourceFile: auth?.sourceFile ?? configured.sourceFile,
    status: "locked"
  };
}

export async function importKimiProvider(
  candidate: LocalAgentProviderCandidate,
  providerNames: string[]
): Promise<LocalAgentProviderImportResult> {
  const configured = readKimiConfiguredProviders().find((item) => item.candidateId === candidate.id);
  if (!configured) {
    throw new Error("Kimi CLI provider configuration was not found.");
  }
  const usesOauth = Boolean(configured.oauthKey && !configured.apiKey);
  const oauthReference = kimiOauthReference(configured);
  const auth = usesOauth ? await resolveKimiAuth(oauthReference) : undefined;
  const token = configured.apiKey || auth?.accessToken;
  if (!token || (auth && kimiAccessTokenExpired(auth))) {
    throw new Error("Kimi CLI credential was not found or is expired.");
  }
  const nextCandidate: LocalAgentProviderCandidate = {
    ...candidate,
    modelDisplayNames: configured.modelDisplayNames,
    modelMetadata: configured.modelMetadata,
    models: configured.models,
    protocol: configured.protocol
  };
  const provider = providerPayload(
    nextCandidate,
    uniqueProviderName(providerNames, configured.name),

View on GitHub (pinned to 99f24806c6)

Solutions

  1. Re-run Kimi CLI setup/login so the provider configuration is written again
  2. Verify the config file exists and contains an entry whose candidateId matches the candidate being imported
  3. If ids drifted after an upgrade, re-enumerate candidates so discovery and import use the same generation
  4. Avoid editing the provider config by hand; use the CLI commands
Defensive patterns

Strategy: validation

Validate before calling

const configured = readKimiConfiguredProviders?.() ?? [];
if (!configured.some(c => c.candidateId === candidate.id)) {
  // re-run discovery/setup before calling importKimiProvider
  await reinitializeKimi();
}

Try / catch

catch (e) {
  if (e instanceof Error && e.message === 'Kimi CLI provider configuration was not found.') {
    await rerunKimiSetup(); // regenerate config then retry import once
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of musistudio/claude-code-router@99f24806c6 (2026-08-27). Data as JSON: /api/errors/717ff4cb8b384cb1. Report an issue: GitHub.