{"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":314,"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    // `opencode models` reads a persistent models.dev cache. Long-lived runner\n    // hosts can therefore report a stale non-empty catalog even while the\n    // configured provider serves the model. Refresh once before treating a\n    // cached miss as authoritative; a successful refresh that still omits the\n    // model retains the strict availability rejection below.\n    try {\n      const refreshedModels = await refreshOpenCodeModelsCached({\n        command: input.command,\n        cwd: input.cwd,\n        env: input.env,\n      });\n      if (refreshedModels.some((entry) => entry.id === model)) {","sourceCodeStart":296,"sourceCodeEnd":332,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/packages/adapters/opencode-local/src/server/models.ts#L296-L332","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":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}