paperclipai/paperclip · error · Error

OpenCode test drives require --model openrouter/<model>, wit

Error message

OpenCode test drives require --model openrouter/<model>, with no empty path segments.

What it means

resolveTestDriveBootstrap validates the --model option for the opencode harness. OpenCode test drives only support OpenRouter-hosted models, and the value must be of the form openrouter/<model> with one or more non-empty, non-whitespace path segments. This error means the passed model was missing or did not match that pattern.

Source

Thrown at cli/src/commands/test-drive.ts:250

  const definition = HARNESS_DEFINITIONS[harness];
  if (!definition) {
    throw new Error(`Unsupported test-drive harness: ${String(harness)}.`);
  }

  const companyName = (options.companyName ?? "Test Company").trim();
  const agentName = (options.agentName ?? "CEO").trim();
  if (!companyName) throw new Error("--company-name cannot be empty.");
  if (!agentName) throw new Error("--agent-name cannot be empty.");

  const model = options.model;
  if (model !== undefined && (!model || model.trim() !== model)) {
    throw new Error("--model cannot be empty or have surrounding whitespace.");
  }
  if (
    harness === "opencode" &&
    (!model || !/^openrouter\/[^/\s]+(?:\/[^/\s]+)*$/.test(model))
  ) {
    throw new Error(
      "OpenCode test drives require --model openrouter/<model>, with no empty path segments.",
    );
  }

  const sourceEnvName = options.apiKeyEnv?.trim() || definition.credentialTarget;
  if (options.apiKeyEnv !== undefined && !/^[A-Za-z_][A-Za-z0-9_]*$/.test(sourceEnvName)) {
    throw new Error("--api-key-env must name a valid environment variable.");
  }
  const credential = options.apiKey ?? env[sourceEnvName];
  if (!credential || credential.trim().length === 0) {
    throw new Error(
      `No credential found. Set ${sourceEnvName}, pass --api-key-env <variable>, or pass --api-key <value>.`,
    );
  }

  return {
    ...definition,
    companyName,

View on GitHub (pinned to 01ad858492)

Solutions

  1. Pass --model openrouter/<model-id>, e.g. --model openrouter/anthropic/claude-3.5-sonnet
  2. Verify the exact model slug on OpenRouter and ensure no empty segments or whitespace
  3. If the harness should not be opencode, pass the intended --harness value that matches your model format

Example fix

// before
paperclip test-drive <app> --harness opencode --model anthropic/claude-3.5-sonnet
// after
paperclip test-drive <app> --harness opencode --model openrouter/anthropic/claude-3.5-sonnet
Defensive patterns

Strategy: validation

Validate before calling

const m = model?.trim();
if (harness === 'opencode' && !/^openrouter\/[^/\s]+(?:\/[^/\s]+)*$/.test(m ?? '')) {
  throw new Error('opencode requires --model openrouter/<model>');
}

Type guard

function isOpenRouterModel(v: unknown): v is string {
  return typeof v === 'string' && /^openrouter\/[^/\s]+(?:\/[^/\s]+)*$/.test(v);
}

Prevention

When it happens

Trigger: Running `paperclip test-drive --harness opencode` with no --model, with a model lacking the openrouter/ prefix (e.g. 'anthropic/claude-3'), with an empty segment (e.g. 'openrouter//foo' or 'openrouter/'), or with whitespace inside the value.

Common situations: Copying a model ID from another provider's docs that omits the openrouter/ prefix; pasting a value with a trailing slash; forgetting --model entirely because other harnesses infer a default model.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of paperclipai/paperclip@01ad858492 (2026-09-10). Data as JSON: /api/errors/0ac1a950172e9fae. Report an issue: GitHub.