{"record":{"id":"659c7f4b3e9f921f","repo":"paperclipai/paperclip","slug":"opencode-local-model-availability-probe-could-no","errorCode":null,"errorMessage":"[opencode-local] Model availability probe could not run for \"${model}\" (${err instanceof Error ? err.message : String(err)}); proceeding with the configured model.","messagePattern":"\\[opencode-local\\] Model availability probe could not run for \"(.+?)\" \\((.+?)\\); proceeding with the configured model\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/adapters/opencode-local/src/server/models.ts","lineNumber":235,"sourceCode":"  if (isTruthyEnvFlag(env.OPENCODE_ALLOW_ALL_MODELS ?? process.env.OPENCODE_ALLOW_ALL_MODELS)) {\n    return [{ id: model, label: model }];\n  }\n\n  let models: AdapterModel[];\n  try {\n    models = await discoverOpenCodeModelsCached({\n      command: input.command,\n      cwd: input.cwd,\n      env: input.env,\n    });\n  } 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(\", \");","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/packages/adapters/opencode-local/src/server/models.ts#L217-L253","documentation":"The local model-availability probe wraps `discoverOpenCodeModelsCached` (which spawns `opencode models`). If spawning throws — CLI missing, timeout, transient provider error — the adapter deliberately does NOT gate the run on the probe: it warns and returns a single-model fallback list so execution proceeds. Historically this threw and destroyed completed agent work mid-flight, so it is now strictly non-fatal.","triggerScenarios":"The `opencode` binary cannot be spawned in the adapter's cwd/env (not on PATH, ENOENT), the probe times out, or the provider listing call fails transiently — any exception from the cached discovery call lands in this branch.","commonSituations":"opencode CLI not installed on the machine/container running paperclip-server; PATH scrubbed for the agent process; slow provider causing a probe timeout; broken opencode auth/config on the host.","solutions":["Confirm `opencode` resolves for the server process: `which opencode` with the same env the adapter uses.","Run `opencode models` locally with that env/cwd to reproduce the underlying error.","Fix opencode installation/auth on that host; discovery is cached, so the next run re-probes.","Treat a single occurrence as transient noise; only investigate if the warn repeats on every run."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// Before enabling the opencode-local adapter, verify the CLI is spawnable:\nimport { execFile } from 'node:child_process';\nimport { promisify } from 'node:util';\nconst exec = promisify(execFile);\n\ntry {\n  await exec('opencode', ['--version']);\n} catch {\n  throw new Error('opencode CLI not found on PATH for the server process');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install the opencode CLI on every host running paperclip-server.","Keep PATH and provider env vars in the env block passed to the adapter.","Treat repeated occurrences as a host problem (missing CLI/auth), single ones as transient.","Remember the probe is best-effort: judge run health by the invocation result, not this warn."],"tags":["opencode","spawn","probe","cli","non-fatal"],"backgroundTag":"cli-invocation-failed","analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}