{"record":{"id":"38903bd71158cecc","repo":"paperclipai/paperclip","slug":"opencode-local-opencode-models-returned-no-mod","errorCode":null,"errorMessage":"[opencode-local] `opencode models` returned no models; proceeding with the configured model \"${model}\".","messagePattern":"\\[opencode-local\\] `opencode models` returned no models; proceeding with the configured model \"(.+?)\"\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/adapters/opencode-local/src/server/models.ts","lineNumber":246,"sourceCode":"  } catch (err) {\n    // The availability probe is a best-effort pre-flight guard, not a gate. If\n    // `opencode models` itself cannot run — a transient CLI error, a timeout, a\n    // provider hiccup — do NOT abort the run. The real invocation is\n    // authoritative, so a probe that can't execute must never be fatal.\n    // (Previously this threw and crashed runs mid-flight, discarding the agent's\n    // completed work and its terminal disposition, which then reopened the issue.)\n    console.warn(\n      `[opencode-local] Model availability probe could not run for \"${model}\" (${\n        err instanceof Error ? err.message : String(err)\n      }); proceeding with the configured model.`,\n    );\n    return [{ id: model, label: model }];\n  }\n\n  if (models.length === 0) {\n    // The probe ran but returned nothing (e.g. a transient provider-auth blip).\n    // Same reasoning as above: warn, don't block the run.\n    console.warn(\n      `[opencode-local] \\`opencode models\\` returned no models; proceeding with the configured model \"${model}\".`,\n    );\n    return [{ id: model, label: model }];\n  }\n\n  if (!models.some((entry) => entry.id === model)) {\n    const sample = models.slice(0, 12).map((entry) => entry.id).join(\", \");\n    throw new Error(\n      `Configured OpenCode model is unavailable: ${model}. Available models: ${sample}${models.length > 12 ? \", ...\" : \"\"}`,\n    );\n  }\n\n  return models;\n}\n\nexport async function listOpenCodeModels(): Promise<AdapterModel[]> {\n  try {\n    return await discoverOpenCodeModelsCached();","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/packages/adapters/opencode-local/src/server/models.ts#L228-L264","documentation":"The local availability probe ran `opencode models` successfully (no exception) but parsing produced zero models — e.g. a transient provider-auth blip. Following the same best-effort policy, the adapter warns and returns a fallback single-model list; the run proceeds and only a genuinely unavailable model fails later, at invocation time.","triggerScenarios":"`opencode models` exits 0 but stdout parses to an empty list: no authenticated providers locally, expired credentials, provider API returning an empty catalog, or a CLI output-format change that defeats the parser.","commonSituations":"Fresh install without `opencode auth login`; expired or rotated provider API keys; custom provider misconfiguration; opencode CLI major upgrade changing the models output shape.","solutions":["Run `opencode models` on the same machine and env; confirm your model id appears.","Re-authenticate the provider (`opencode auth login` or refresh the API key env var).","If the list looks non-empty but the warn still fires, check for an `opencode` CLI version mismatch and pin a compatible one.","Confirm the configured model id string exactly matches a listed entry."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const { stdout } = await exec('opencode', ['models']);\nconst listed = stdout.split('\\n').map((s) => s.trim()).filter(Boolean);\nif (!listed.includes(configuredModel)) {\n  throw new Error(`Model ${configuredModel} not listed by opencode models; run opencode auth login`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `opencode models` in server bootstrap smoke tests and assert the configured model id appears.","Automate provider credential refresh before expiry.","Pin the opencode CLI version in deployment images.","Alert on this warn: it usually precedes a hard model-unavailable error on the next real run."],"tags":["opencode","models","provider-auth","probe"],"backgroundTag":"empty-models-list","analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}