can1357/oh-my-pi · error

Pass at least one model selector, e.g. `omp if-bench opus gp

Error message

Pass at least one model selector, e.g. `omp if-bench opus gpt-5.2`

What it means

runIfBenchCommand requires at least one model selector. If command.models is empty it throws immediately with usage guidance before resolving any flags or running threads.

Source

Thrown at packages/coding-agent/src/if-bench/index.ts:67

	setExitCode?: (code: number) => void;
	stdoutIsTTY?: boolean;
}

function positiveInteger(name: string, value: number | undefined, fallback: number): number {
	if (value === undefined) return fallback;
	if (!Number.isInteger(value) || value <= 0) {
		throw new Error(`Expected --${name} to be a positive integer, got ${value}`);
	}
	return value;
}

/** Resolve selectors, run every thread, and render the live board plus scoreboard. */
export async function runIfBenchCommand(
	command: IfBenchCommandArgs,
	deps: IfBenchDependencies = {},
): Promise<IfBenchSummary> {
	if (command.models.length === 0) {
		throw new Error("Pass at least one model selector, e.g. `omp if-bench opus gpt-5.2`");
	}
	const maxTurns = positiveInteger("turns", command.flags.turns, DEFAULT_TURNS);
	const arrayLength = positiveInteger("length", command.flags.length, DEFAULT_ARRAY_LENGTH);
	const maxTokens = positiveInteger("max-tokens", command.flags.maxTokens, DEFAULT_MAX_TOKENS);
	const nyaMax = positiveInteger("nya-max", command.flags.nyaMax, DEFAULT_NYA_MAX);
	const par = positiveInteger("par", command.flags.par, DEFAULT_PAR);
	const json = command.flags.json === true;
	// Fail on an unusable array length before opening the auth vault.
	initialArray(arrayLength);

	const writeStdout = deps.writeStdout ?? ((text: string) => process.stdout.write(text));
	const writeStderr = deps.writeStderr ?? ((text: string) => process.stderr.write(text));
	const setExitCode =
		deps.setExitCode ??
		((code: number) => {
			process.exitCode = code;
		});
	const interactive = deps.stdoutIsTTY ?? process.stdout.isTTY === true;

View on GitHub (pinned to 9690622007)

Solutions

  1. Pass at least one model selector: `omp if-bench opus gpt-5.2`
  2. In scripts, guard that the selector variable is non-empty before invoking
  3. Quote and verify arguments so empty strings don't silently disappear

Example fix

// before
omp if-bench --turns 5
// after
omp if-bench opus --turns 5
Defensive patterns

Strategy: validation

Validate before calling

if (!command.models || command.models.length === 0) {
  throw new Error("omp if-bench requires at least one model selector");
}

Type guard

function hasModels(c: { models?: string[] }): c is { models: [string, ...string[]] } {
  return Array.isArray(c.models) && c.models.length > 0;
}

Try / catch

try {
  await runIfBenchCommand(args);
} catch (err) {
  if (err instanceof Error && err.message.includes("at least one model selector")) {
    console.error("Usage: omp if-bench <model-selector>...");
    process.exitCode = 2;
  } else throw err;
}

Prevention

When it happens

Trigger: Running `omp if-bench` with no positional model selectors; a wrapper script dropping the selector arguments; argument parsing swallowing empty strings so models ends up as [].

Common situations: Forgetting the selector in shell history re-runs; CI scripts with unset selector variables expanding to nothing; misquoted arguments producing zero parsed selectors.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/5d4e926c15d1f2b8. Report an issue: GitHub.