{"record":{"id":"fcab0ceffd1868e0","repo":"musistudio/claude-code-router","slug":"unsupported-opencode-protocol-candidate-protoco","errorCode":null,"errorMessage":"Unsupported OpenCode protocol: ${candidate.protocol}","messagePattern":"Unsupported OpenCode protocol: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/agents/local-providers/opencode.ts","lineNumber":138,"sourceCode":"        status: \"available\"\n      };\n    }\n    return missingCandidate(\"opencode\", id, name, protocol, models, modelDisplayNames);\n  });\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: []","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/musistudio/claude-code-router/blob/99f24806c6a2c660b16e53e95211c517448a6c90/packages/core/src/agents/local-providers/opencode.ts#L120-L156","documentation":"The candidate protocol for an OpenCode provider import is not in the list of known OpenCode protocols (checked with isOpenCodeProtocol).","triggerScenarios":"importOpenCodeProvider receives a candidate whose protocol string is anything other than the supported OpenCode protocol identifiers.","commonSituations":"Version mismatch: newer OpenCode CLI reports a protocol the app doesn't recognize, or a hand-crafted candidate with a typo in protocol.","solutions":["Update the app to a version supporting the new OpenCode protocol.","Verify the candidate's protocol string matches supported values (e.g. anthropic_messages/openai_responses style ids).","Regenerate the candidate list via getLocalAgentProviderCandidates so protocols are re-detected."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"if (!isOpenCodeProtocol(candidate.protocol)) skipCandidate(candidate);","typeGuard":"// reuse the exported guard\nisOpenCodeProtocol(candidate.protocol)","tryCatchPattern":"catch (e) { if ((e as Error).message.startsWith('Unsupported OpenCode protocol')) refreshCandidates(); }","preventionTips":["Re-detect candidates after CLI updates.","Validate protocol before import calls."],"tags":["opencode","protocol","unsupported"],"backgroundTag":"unsupported-protocol-version","analyzedSha":"99f24806c6a2c660b16e53e95211c517448a6c90","analyzedAt":"2026-08-27T04:11:01.184Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}