paperclipai/paperclip · error · Error
`opencode models` failed on the remote execution target: ${d
Error message
`opencode models` failed on the remote execution target: ${detail} What it means
Thrown by the REMOTE OpenCode model probe when `opencode models` exits with a non-zero code on the remote/sandbox target. The detail is the first non-empty line of stderr, falling back to stdout, so the operator sees opencode's own error. This is a target-side failure, not a Paperclip adapter bug.
Source
Thrown at packages/adapters/opencode-local/src/server/execute.ts:133
input.executionTarget,
input.command,
["models"],
{
cwd: input.cwd,
env: input.env,
timeoutSec: probeTimeoutSec,
graceSec: input.graceSec,
onLog: async () => {},
},
);
if (probe.timedOut) {
throw new Error(`\`opencode models\` timed out on the remote execution target after ${probeTimeoutSec}s.`);
}
if ((probe.exitCode ?? 1) !== 0) {
const detail = firstNonEmptyLine(probe.stderr) || firstNonEmptyLine(probe.stdout);
throw new Error(
detail
? `\`opencode models\` failed on the remote execution target: ${detail}`
: "`opencode models` failed on the remote execution target.",
);
}
const models = parseOpenCodeModelsOutput(probe.stdout);
if (models.length === 0) {
throw new Error(
"OpenCode returned no models on the remote execution target. Run `opencode models` there and verify provider auth.",
);
}
if (!models.some((entry) => entry.id === model)) {
const sample = models.slice(0, 12).map((entry) => entry.id).join(", ");
throw new Error(
`Configured OpenCode model is unavailable on the remote execution target: ${model}. Available models: ${sample}${models.length > 12 ? ", ..." : ""}`,
);View on GitHub (pinned to 67001ec6eb)
Solutions
- Read the detail line — it is opencode's own error message and usually names the cause (auth, missing binary, config).
- Ensure opencode is installed and on PATH in the remote/sandbox image; run `opencode models` there manually to reproduce.
- Configure provider auth inside the target (API key env or opencode login) so the binary can enumerate models.
- If auth is correct but the version is old, upgrade opencode in the image.
Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-check the target has opencode and auth before the run.
async function remoteHasOpenCode(target: ExecutionTarget, cwd: string, env: NodeJS.ProcessEnv): Promise<boolean> {
const r = await runAdapterExecutionTargetProcess(runId, target, "opencode", ["--version"], { cwd, env, timeoutSec: 10, graceSec: 2, onLog: async () => {} });
return (r.exitCode ?? 1) === 0;
} Try / catch
try {
await ensureOpenCodeModelAvailableOnTarget(input);
} catch (e) {
if (e instanceof Error && /`opencode models` failed on the remote execution target/.test(e.message)) {
// parse the detail line; guide the operator to install opencode or auth the provider; non-retryable until fixed
}
throw e;
} Prevention
- Bake opencode and provider auth into the sandbox image.
- Verify PATH in the target includes the opencode binary.
- Run `opencode models` in CI against the image to catch regressions.
When it happens
Trigger: runAdapterExecutionTargetProcess returns exitCode != 0 (and not timedOut) for `opencode models` on a remote target; detail = firstNonEmptyLine(stderr) || firstNonEmptyLine(stdout).
Common situations: opencode binary not installed or not on PATH in the sandbox image; provider auth missing/expired inside the target; opencode version mismatch producing a fatal startup error; shared-library/permission error launching the binary.
Related errors
- `opencode models` timed out on the remote execution target a
- OpenCode returned no models on the remote execution target.
- Configured OpenCode model is unavailable on the remote execu
- `opencode models` failed: ${detail}
- OpenCode requires `adapterConfig.model` in provider/model fo
AI-assisted analysis of paperclipai/paperclip@67001ec6eb (2026-08-12).
Data as JSON: /api/errors/8bc0d390c5b7cfbf.
Report an issue: GitHub.