musistudio/claude-code-router · warning · Error
OpenCode CLI public models were not found.
Error message
OpenCode CLI public models were not found.
What it means
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.
Source
Thrown at packages/core/src/agents/local-providers/opencode.ts:142
});
}
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: []
};
}
const apiKey = credential?.apiKey;
if (!apiKey) {View on GitHub (pinned to 99f24806c6)
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.
Example fix
// before request.models = ["new-model-x", "known-model"]; // after request.models = ["known-model"]; // or authenticate first
Defensive patterns
Strategy: validation
Validate before calling
const missing = candidate.models.filter(m => !publicCatalog[protocol].includes(m)); if (missing.length) authenticateOrDrop(missing);
Type guard
null
Try / catch
catch (e) { if ((e as Error).message.includes('public models')) await promptOpenCodeLogin(); } Prevention
- Authenticate before importing model-heavy providers.
- Update app catalogs when new models ship.
When it happens
Trigger: importOpenCodeProvider with publicOnly=true and candidate.models containing at least one model absent from catalog.models[protocol].
Common situations: 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.
Related errors
- OpenCode CLI API key was not found.
- Unsupported OpenCode protocol: ${candidate.protocol}
- OpenCode App was not found. Install OpenCode App or set OPEN
- No available models. Configure at least one provider with a
- Model name is too long.
AI-assisted analysis of musistudio/claude-code-router@99f24806c6 (2026-08-27).
Data as JSON: /api/errors/8c8835f96b57bdc6.
Report an issue: GitHub.