{"record":{"id":"5d4e926c15d1f2b8","repo":"can1357/oh-my-pi","slug":"pass-at-least-one-model-selector-e-g-omp-if-ben","errorCode":null,"errorMessage":"Pass at least one model selector, e.g. `omp if-bench opus gpt-5.2`","messagePattern":"Pass at least one model selector, e\\.g\\. `omp if-bench opus gpt-5\\.2`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/if-bench/index.ts","lineNumber":67,"sourceCode":"\tsetExitCode?: (code: number) => void;\n\tstdoutIsTTY?: boolean;\n}\n\nfunction positiveInteger(name: string, value: number | undefined, fallback: number): number {\n\tif (value === undefined) return fallback;\n\tif (!Number.isInteger(value) || value <= 0) {\n\t\tthrow new Error(`Expected --${name} to be a positive integer, got ${value}`);\n\t}\n\treturn value;\n}\n\n/** Resolve selectors, run every thread, and render the live board plus scoreboard. */\nexport async function runIfBenchCommand(\n\tcommand: IfBenchCommandArgs,\n\tdeps: IfBenchDependencies = {},\n): Promise<IfBenchSummary> {\n\tif (command.models.length === 0) {\n\t\tthrow new Error(\"Pass at least one model selector, e.g. `omp if-bench opus gpt-5.2`\");\n\t}\n\tconst maxTurns = positiveInteger(\"turns\", command.flags.turns, DEFAULT_TURNS);\n\tconst arrayLength = positiveInteger(\"length\", command.flags.length, DEFAULT_ARRAY_LENGTH);\n\tconst maxTokens = positiveInteger(\"max-tokens\", command.flags.maxTokens, DEFAULT_MAX_TOKENS);\n\tconst nyaMax = positiveInteger(\"nya-max\", command.flags.nyaMax, DEFAULT_NYA_MAX);\n\tconst par = positiveInteger(\"par\", command.flags.par, DEFAULT_PAR);\n\tconst json = command.flags.json === true;\n\t// Fail on an unusable array length before opening the auth vault.\n\tinitialArray(arrayLength);\n\n\tconst writeStdout = deps.writeStdout ?? ((text: string) => process.stdout.write(text));\n\tconst writeStderr = deps.writeStderr ?? ((text: string) => process.stderr.write(text));\n\tconst setExitCode =\n\t\tdeps.setExitCode ??\n\t\t((code: number) => {\n\t\t\tprocess.exitCode = code;\n\t\t});\n\tconst interactive = deps.stdoutIsTTY ?? process.stdout.isTTY === true;","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/if-bench/index.ts#L49-L85","documentation":"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.","triggerScenarios":"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 [].","commonSituations":"Forgetting the selector in shell history re-runs; CI scripts with unset selector variables expanding to nothing; misquoted arguments producing zero parsed selectors.","solutions":["Pass at least one model selector: `omp if-bench opus gpt-5.2`","In scripts, guard that the selector variable is non-empty before invoking","Quote and verify arguments so empty strings don't silently disappear"],"exampleFix":"// before\nomp if-bench --turns 5\n// after\nomp if-bench opus --turns 5","handlingStrategy":"validation","validationCode":"if (!command.models || command.models.length === 0) {\n  throw new Error(\"omp if-bench requires at least one model selector\");\n}","typeGuard":"function hasModels(c: { models?: string[] }): c is { models: [string, ...string[]] } {\n  return Array.isArray(c.models) && c.models.length > 0;\n}","tryCatchPattern":"try {\n  await runIfBenchCommand(args);\n} catch (err) {\n  if (err instanceof Error && err.message.includes(\"at least one model selector\")) {\n    console.error(\"Usage: omp if-bench <model-selector>...\");\n    process.exitCode = 2;\n  } else throw err;\n}","preventionTips":["Always include at least one positional selector on the command line","Guard wrapper scripts: [ -n \"$SELECTOR\" ] before exec","Quote selectors so empty strings don't get dropped by the shell"],"tags":["cli","validation","arguments"],"backgroundTag":"missing-required-argument","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}