{"record":{"id":"6fe9d324a3c3a8bd","repo":"musistudio/claude-code-router","slug":"zcode-provider-api-key-was-not-found-in-zcode-conf","errorCode":null,"errorMessage":"ZCode provider API key was not found in ZCode config.","messagePattern":"ZCode provider API key was not found in ZCode config\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/agents/local-providers/zcode.ts","lineNumber":94,"sourceCode":"      detail: \"ZCode login was detected, but no usable provider API key was found in ZCode config.\",\n      id: \"zcode-api\",\n      importable: false,\n      kind: \"zcode\",\n      modelDisplayNames,\n      models,\n      name: \"ZCode API\",\n      protocol: \"anthropic_messages\",\n      sourceFile: credentials.sourceFile,\n      status: \"locked\"\n    };\n  }\n  return missingCandidate(\"zcode\", \"zcode-api\", \"ZCode API\", \"anthropic_messages\", models, modelDisplayNames);\n}\n\nexport function importZcodeProvider(candidate: LocalAgentProviderCandidate, providerNames: string[]): LocalAgentProviderImportResult {\n  const configuredProvider = readZcodeConfiguredProvider();\n  if (!configuredProvider) {\n    throw new Error(\"ZCode provider API key was not found in ZCode config.\");\n  }\n  const provider = providerPayload(\n    {\n      ...candidate,\n      modelDisplayNames: configuredProvider.models.length > 0 ? configuredProvider.modelDisplayNames : candidate.modelDisplayNames,\n      models: configuredProvider.models.length > 0 ? configuredProvider.models : candidate.models\n    },\n    uniqueProviderName(providerNames, \"ZCode API\"),\n    configuredProvider.baseUrl,\n    zcodeProviderAccountConfig(configuredProvider.baseUrl)\n  );\n  return {\n    candidate,\n    provider,\n    providerPlugins: [\n      apiKeyAuthPlugin(\"zcode-api-key\", configuredProvider.apiKey),\n      apiKeyAuthPlugin(\"zcode-api-key-internal\", configuredProvider.apiKey, providerInternalNamePlaceholder)\n    ]","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/musistudio/claude-code-router/blob/99f24806c6a2c660b16e53e95211c517448a6c90/packages/core/src/agents/local-providers/zcode.ts#L76-L112","documentation":"importZcodeProvider requires a configured provider (with API key) in the ZCode config; readZcodeConfiguredProvider returned null so there is nothing to import.","triggerScenarios":"Importing the zcode candidate when ~/.zcode config lacks a provider entry or has no API key.","commonSituations":"ZCode CLI installed but never configured, config file moved/renamed between versions, or key field renamed.","solutions":["Run `zcode` and configure a provider with an API key, then retry import.","Check the ZCode config file exists and contains the provider+key fields readZcodeConfiguredProvider expects.","Update the app if ZCode changed its config schema."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (!readZcodeConfiguredProvider()) promptZcodeSetup();","typeGuard":"function zcodeReady(p: unknown): p is { apiKey: string; models: string[] } { return !!p && typeof (p as any).apiKey === 'string'; }","tryCatchPattern":"catch (e) { if ((e as Error).message.includes('ZCode provider API key')) showZcodeConfigHelp(); }","preventionTips":["Configure a ZCode provider with key before import.","Re-check config after ZCode updates."],"tags":["zcode","api-key","config"],"backgroundTag":"missing-api-key","analyzedSha":"99f24806c6a2c660b16e53e95211c517448a6c90","analyzedAt":"2026-08-27T04:11:01.184Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}