paperclipai/paperclip · warning

[opencode-local] `opencode models` returned no models; proce

Error message

[opencode-local] `opencode models` returned no models; proceeding with the configured model "${model}".

What it means

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.

Source

Thrown at packages/adapters/opencode-local/src/server/models.ts:246

  } catch (err) {
    // The availability probe is a best-effort pre-flight guard, not a gate. If
    // `opencode models` itself cannot run — a transient CLI error, a timeout, a
    // provider hiccup — do NOT abort the run. The real invocation is
    // authoritative, so a probe that can't execute must never be fatal.
    // (Previously this threw and crashed runs mid-flight, discarding the agent's
    // completed work and its terminal disposition, which then reopened the issue.)
    console.warn(
      `[opencode-local] Model availability probe could not run for "${model}" (${
        err instanceof Error ? err.message : String(err)
      }); proceeding with the configured model.`,
    );
    return [{ id: model, label: model }];
  }

  if (models.length === 0) {
    // The probe ran but returned nothing (e.g. a transient provider-auth blip).
    // Same reasoning as above: warn, don't block the run.
    console.warn(
      `[opencode-local] \`opencode models\` returned no models; proceeding with the configured model "${model}".`,
    );
    return [{ id: model, label: model }];
  }

  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: ${model}. Available models: ${sample}${models.length > 12 ? ", ..." : ""}`,
    );
  }

  return models;
}

export async function listOpenCodeModels(): Promise<AdapterModel[]> {
  try {
    return await discoverOpenCodeModelsCached();

View on GitHub (pinned to 120ae5428f)

Solutions

  1. Run `opencode models` on the same machine and env; confirm your model id appears.
  2. Re-authenticate the provider (`opencode auth login` or refresh the API key env var).
  3. If the list looks non-empty but the warn still fires, check for an `opencode` CLI version mismatch and pin a compatible one.
  4. Confirm the configured model id string exactly matches a listed entry.
Defensive patterns

Strategy: validation

Validate before calling

const { stdout } = await exec('opencode', ['models']);
const listed = stdout.split('\n').map((s) => s.trim()).filter(Boolean);
if (!listed.includes(configuredModel)) {
  throw new Error(`Model ${configuredModel} not listed by opencode models; run opencode auth login`);
}

Prevention

When it happens

Trigger: `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.

Common situations: Fresh install without `opencode auth login`; expired or rotated provider API keys; custom provider misconfiguration; opencode CLI major upgrade changing the models output shape.

Related errors


AI-assisted analysis of paperclipai/paperclip@120ae5428f (2026-08-18). Data as JSON: /api/errors/38903bd71158cecc. Report an issue: GitHub.