musistudio/claude-code-router · error · Error
Unsupported OpenCode protocol: ${candidate.protocol}
Error message
Unsupported OpenCode protocol: ${candidate.protocol} What it means
The candidate protocol for an OpenCode provider import is not in the list of known OpenCode protocols (checked with isOpenCodeProtocol).
Source
Thrown at packages/core/src/agents/local-providers/opencode.ts:138
status: "available"
};
}
return missingCandidate("opencode", id, name, protocol, models, modelDisplayNames);
});
}
export function importOpenCodeProvider(
candidate: LocalAgentProviderCandidate,
providerNames: string[]
): LocalAgentProviderImportResult {
const credential = readOpenCodeCredential();
if (credential?.hasCredential && !credential.apiKey) {
throw new Error("OpenCode CLI API key was not found.");
}
const publicOnly = !credential;
const catalog = readOpenCodeCatalog({ publicOnly });
if (!isOpenCodeProtocol(candidate.protocol)) {
throw new Error(`Unsupported OpenCode protocol: ${candidate.protocol}`);
}
const protocol = candidate.protocol;
if (publicOnly && !candidate.models.every((model) => catalog.models[protocol].includes(model))) {
throw new Error("OpenCode CLI public models were not found.");
}
const provider = providerPayload(
candidate,
uniqueProviderName(providerNames, candidate.name),
catalog.baseUrl
);
if (publicOnly) {
return {
candidate,
provider: {
...provider,
apiKey: "public"
},
providerPlugins: []View on GitHub (pinned to 99f24806c6)
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.
Defensive patterns
Strategy: type-guard
Validate before calling
if (!isOpenCodeProtocol(candidate.protocol)) skipCandidate(candidate);
Type guard
// reuse the exported guard isOpenCodeProtocol(candidate.protocol)
Try / catch
catch (e) { if ((e as Error).message.startsWith('Unsupported OpenCode protocol')) refreshCandidates(); } Prevention
- Re-detect candidates after CLI updates.
- Validate protocol before import calls.
When it happens
Trigger: importOpenCodeProvider receives a candidate whose protocol string is anything other than the supported OpenCode protocol identifiers.
Common situations: Version mismatch: newer OpenCode CLI reports a protocol the app doesn't recognize, or a hand-crafted candidate with a typo in protocol.
Related errors
- OpenCode CLI API key was not found.
- OpenCode CLI public models were not found.
- Local agent provider model probing is not supported.
- OpenCode App was not found. Install OpenCode App or set OPEN
- Unsupported link protocol.
AI-assisted analysis of musistudio/claude-code-router@99f24806c6 (2026-08-27).
Data as JSON: /api/errors/fcab0ceffd1868e0.
Report an issue: GitHub.