{"record":{"id":"fed647a5a3be7160","repo":"paperclipai/paperclip","slug":"opencode-local-remote-opencode-models-returned","errorCode":null,"errorMessage":"[opencode-local] Remote `opencode models` returned no models; proceeding with the configured model \"${model}\".","messagePattern":"\\[opencode-local\\] Remote `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/execute.ts","lineNumber":151,"sourceCode":"    console.warn(\n      `[opencode-local] Remote model availability probe for \"${model}\" timed out after ${probeTimeoutSec}s; proceeding with the configured model.`,\n    );\n    return;\n  }\n\n  if ((probe.exitCode ?? 1) !== 0) {\n    const detail = firstNonEmptyLine(probe.stderr) || firstNonEmptyLine(probe.stdout);\n    console.warn(\n      `[opencode-local] Remote \\`opencode models\\` could not run for \"${model}\"${\n        detail ? ` (${detail})` : \"\"\n      }; proceeding with the configured model.`,\n    );\n    return;\n  }\n\n  const models = parseOpenCodeModelsOutput(probe.stdout);\n  if (models.length === 0) {\n    console.warn(\n      `[opencode-local] Remote \\`opencode models\\` returned no models; proceeding with the configured model \"${model}\".`,\n    );\n    return;\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 on the remote execution target: ${model}. Available models: ${sample}${models.length > 12 ? \", ...\" : \"\"}`,\n    );\n  }\n}\n\nfunction claudeSkillsHome(): string {\n  return path.join(os.homedir(), \".claude\", \"skills\");\n}\n\nasync function ensureOpenCodeSkillsInjected(","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/packages/adapters/opencode-local/src/server/execute.ts#L133-L169","documentation":"The opencode-local adapter runs `opencode models` on the remote execution target as a best-effort pre-flight check that the configured model exists. When that command exits 0 but the parsed model list is empty, the adapter logs this warning and proceeds with the configured model anyway; the real invocation is authoritative. It is warn-only and never blocks the run by itself.","triggerScenarios":"A run is dispatched to a remote target where `opencode models` succeeds but yields zero parsed entries: no provider authenticated on the remote host, an empty provider list in the remote opencode config, a transient provider-auth blip, or an `opencode` CLI version whose `models` output format the parser no longer recognizes.","commonSituations":"Fresh remote host with opencode installed but `opencode auth login` never run; provider API-key env vars not forwarded through the adapter's env config; remote opencode upgraded and its output shape changed; remote opencode.json pointing at a disabled provider.","solutions":["SSH to the remote host and run `opencode models` manually; confirm it lists the configured model id.","Authenticate the provider on the remote (`opencode auth login`) or forward the provider API key via the adapter's env configuration.","Verify the model id in the Paperclip agent/model config exactly matches a listed id (case-sensitive).","Pin or upgrade the remote opencode CLI to a version whose `models` output the adapter parses."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-flight, on the remote host, before scheduling a run:\nimport { execFile } from 'node:child_process';\nimport { promisify } from 'node:util';\nconst exec = promisify(execFile);\n\nasync function remoteModelAvailable(model: string): Promise<boolean> {\n  const { stdout } = await exec('opencode', ['models']);\n  const ids = stdout.split('\\n').map((l) => l.trim()).filter(Boolean);\n  return ids.includes(model);\n}\n// Skip or fix the run target when remoteModelAvailable(model) === false.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Authenticate providers on every remote execution host, not just locally.","Forward provider API-key env vars through the adapter's env configuration.","Pin the opencode CLI version across hosts so `models` output stays parseable.","Alert on this warn in server logs — it reliably predicts a later model-unavailable failure."],"tags":["opencode","models","pre-flight","remote","provider-auth"],"backgroundTag":"empty-models-list","analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}