{"record":{"id":"8c8835f96b57bdc6","repo":"musistudio/claude-code-router","slug":"opencode-cli-public-models-were-not-found","errorCode":null,"errorMessage":"OpenCode CLI public models were not found.","messagePattern":"OpenCode CLI public models were not found\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"packages/core/src/agents/local-providers/opencode.ts","lineNumber":142,"sourceCode":"  });\n}\n\nexport function importOpenCodeProvider(\n  candidate: LocalAgentProviderCandidate,\n  providerNames: string[]\n): LocalAgentProviderImportResult {\n  const credential = readOpenCodeCredential();\n  if (credential?.hasCredential && !credential.apiKey) {\n    throw new Error(\"OpenCode CLI API key was not found.\");\n  }\n  const publicOnly = !credential;\n  const catalog = readOpenCodeCatalog({ publicOnly });\n  if (!isOpenCodeProtocol(candidate.protocol)) {\n    throw new Error(`Unsupported OpenCode protocol: ${candidate.protocol}`);\n  }\n  const protocol = candidate.protocol;\n  if (publicOnly && !candidate.models.every((model) => catalog.models[protocol].includes(model))) {\n    throw new Error(\"OpenCode CLI public models were not found.\");\n  }\n  const provider = providerPayload(\n    candidate,\n    uniqueProviderName(providerNames, candidate.name),\n    catalog.baseUrl\n  );\n  if (publicOnly) {\n    return {\n      candidate,\n      provider: {\n        ...provider,\n        apiKey: \"public\"\n      },\n      providerPlugins: []\n    };\n  }\n  const apiKey = credential?.apiKey;\n  if (!apiKey) {","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/musistudio/claude-code-router/blob/99f24806c6a2c660b16e53e95211c517448a6c90/packages/core/src/agents/local-providers/opencode.ts#L124-L160","documentation":"When no OpenCode credential exists (publicOnly mode), every requested model must be in the static public catalog for the protocol; if any model is missing, the import is rejected.","triggerScenarios":"importOpenCodeProvider with publicOnly=true and candidate.models containing at least one model absent from catalog.models[protocol].","commonSituations":"A new model shipped in OpenCode CLI but not yet in this app's bundled catalog; a user-editable config lists a custom/renamed model.","solutions":["Authenticate with OpenCode (`opencode auth login`) so publicOnly is false and the live catalog is used.","Update the app so the public catalog includes the model.","Remove the unsupported model from the candidate model list before importing."],"exampleFix":"// before\nrequest.models = [\"new-model-x\", \"known-model\"];\n// after\nrequest.models = [\"known-model\"]; // or authenticate first","handlingStrategy":"validation","validationCode":"const missing = candidate.models.filter(m => !publicCatalog[protocol].includes(m));\nif (missing.length) authenticateOrDrop(missing);","typeGuard":"null","tryCatchPattern":"catch (e) { if ((e as Error).message.includes('public models')) await promptOpenCodeLogin(); }","preventionTips":["Authenticate before importing model-heavy providers.","Update app catalogs when new models ship."],"tags":["opencode","models","catalog"],"backgroundTag":"model-not-found","analyzedSha":"99f24806c6a2c660b16e53e95211c517448a6c90","analyzedAt":"2026-08-27T04:11:01.184Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}