musistudio/claude-code-router · error · Error

${credentialIssue.message}

Error message

${credentialIssue.message}

What it means

Same safety check as error 95 but for a per-credential entry inside provider.credentials; providerCredentialApiKey + safety issue message is thrown.

Source

Thrown at packages/core/src/config/config.ts:580

    const baseUrl = providerBaseUrl(provider);
    const issue = providerApiKeySafetyIssue({
      apiKey,
      baseUrl,
      name: provider.name
    });
    if (issue) {
      throw new Error(issue.message);
    }
    assertProviderAccountApiKeyTargetsAreSafe(provider, apiKey, baseUrl);
    for (const credential of provider.credentials ?? []) {
      const credentialApiKey = providerCredentialApiKey(credential);
      const credentialIssue = providerApiKeySafetyIssue({
        apiKey: credentialApiKey,
        baseUrl,
        name: provider.name
      });
      if (credentialIssue) {
        throw new Error(credentialIssue.message);
      }
      assertProviderCredentialAccountApiKeyTargetsAreSafe(provider, credential, credentialApiKey, baseUrl);
    }
  }
}

function assertProviderAccountApiKeyTargetsAreSafe(provider: GatewayProviderConfig, apiKey: string, baseUrl: string): void {
  if (!apiKey || provider.account?.enabled === false) {
    return;
  }

  const presetId = findProviderPresetByBaseUrl(baseUrl)?.id;
  for (const connector of provider.account?.connectors ?? []) {
    const endpoints = providerAccountConnectorApiKeyEndpoints(connector);
    for (const endpoint of endpoints) {
      const issue = providerEndpointCanReceiveProviderApiKey({
        apiKey,
        endpoint,

View on GitHub (pinned to 99f24806c6)

Solutions

  1. Inspect issue.message to identify the offending credential.
  2. Fix or delete that credential entry in provider.credentials.
  3. Re-validate keys against the provider's actual endpoint.
Defensive patterns

Strategy: validation

Validate before calling

for (const c of provider.credentials ?? []) {
  if (providerApiKeySafetyIssue({ apiKey: providerCredentialApiKey(c), baseUrl, name: provider.name })) flag(c);
}

Type guard

function credentialKeyIsSafe(cred: unknown, baseUrl: string): boolean {
  return !providerApiKeySafetyIssue({ apiKey: providerCredentialApiKey(cred), baseUrl, name: 'x' });
}

Try / catch

catch (e) { highlightFailingCredential(e); }

Prevention

When it happens

Trigger: A provider with multiple credentials where one credential's key/target fails providerApiKeySafetyIssue during config save.

Common situations: Multi-account setups where one account's key belongs to a different service than the baseUrl.

Understand the failure class

Background: Config validation failed: what "invalid value for {key}" and settings-rejection errors mean across 19 open-source libraries — this error's family across 19 libraries.

Related errors


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