paperclipai/paperclip · error · Error

`opencode models` timed out on the remote execution target a

Error message

`opencode models` timed out on the remote execution target after ${probeTimeoutSec}s.

What it means

Thrown by the REMOTE OpenCode model-availability probe (execute.ts) when `opencode models` run on the remote/sandbox execution target does not finish within probeTimeoutSec. The probe timeout is the min of the caller-supplied timeoutSec and REMOTE_OPENCODE_MODELS_PROBE_SANDBOX_TIMEOUT_SEC (sandbox) or REMOTE_OPENCODE_MODELS_PROBE_DEFAULT_TIMEOUT_SEC (other remote). This is a remote-target check, distinct from the local discovery timeout in models.ts.

Source

Thrown at packages/adapters/opencode-local/src/server/execute.ts:128

  const probeTimeoutSec = input.timeoutSec > 0
    ? Math.min(input.timeoutSec, defaultProbeTimeoutSec)
    : defaultProbeTimeoutSec;
  const probe = await runAdapterExecutionTargetProcess(
    input.runId,
    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.",
    );
  }

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Increase the caller-supplied timeoutSec so the probe window (min with the default cap) grows.
  2. Raise REMOTE_OPENCODE_MODELS_PROBE_SANDBOX_TIMEOUT_SEC if the sandbox is known to be slow to warm.
  3. Set OPENCODE_ALLOW_ALL_MODELS in the run env to skip the probe entirely for sandbox runs where the model is known-good.
  4. Check the sandbox for a hung opencode process or an interactive prompt; ensure non-interactive provider auth.
Defensive patterns

Strategy: validation

Validate before calling

// If the model is known-good and the sandbox is slow, bypass the probe.
const skipProbe = isTruthyEnvFlag(input.env.OPENCODE_ALLOW_ALL_MODELS ?? process.env.OPENCODE_ALLOW_ALL_MODELS);
if (skipProbe) { /* skip remote probe */ }

Try / catch

try {
  await ensureOpenCodeModelAvailableOnTarget(input);
} catch (e) {
  if (e instanceof Error && /timed out on the remote execution target/.test(e.message)) {
    // either retry once with a larger timeoutSec, or set OPENCODE_ALLOW_ALL_MODELS and proceed
  } else throw e;
}

Prevention

When it happens

Trigger: runAdapterExecutionTargetProcess for `opencode models` returns { timedOut: true } on a remote/sandbox target — the binary started but never exited within the probe window.

Common situations: Slow sandbox cold start (image pull, init); opencode waiting on a provider network call that hangs; sandbox CPU starvation; opencode prompting interactively with no TTY so it blocks.

Understand the failure class

Related errors


AI-assisted analysis of paperclipai/paperclip@67001ec6eb (2026-08-12). Data as JSON: /api/errors/b7ada0b3fffaef3a. Report an issue: GitHub.