can1357/oh-my-pi · error · Error
unknown option: ${arg}
Error message
unknown option: ${arg} What it means
parseArgs' switch has no case for the given token, so any unrecognized flag (anything not consumed by the known cases, including flags that must not start with '-' in value position) throws this error.
Source
Thrown at packages/metaharness/src/tb/cli.ts:196
}
case "--rebuild-agent":
config.rebuildAgent = true;
break;
case "--vmon-url":
config.vmonUrl = take();
break;
case "--vmon-token":
config.vmonToken = take();
break;
case "--list":
config.list = true;
break;
case "-h":
case "--help":
config.help = true;
break;
default:
throw new Error(`unknown option: ${arg}`);
}
}
if (config.help) return config;
if (config.models.length === 0) throw new Error("at least one --model is required");
for (const model of config.models) {
const slash = model.indexOf("/");
if (slash <= 0 || slash === model.length - 1) throw new Error(`invalid model ${model}; expected provider/model`);
}
for (const [flag, value] of [
["--attempts", config.attempts],
["--concurrency", config.concurrency],
["--epochs", config.epochs],
] as const) {
if (!Number.isInteger(value) || value < 1) throw new Error(`${flag} must be a positive integer`);
}
if (config.budget !== null && (!Number.isFinite(config.budget) || config.budget < 0)) {
throw new Error("--budget must be a non-negative number");View on GitHub (pinned to 9690622007)
Solutions
- Run `tb --help` and use only documented flags
- Check for renames (e.g. --epoch vs --epochs)
- Quote or reorder arguments so option values don't look like flags
Example fix
// before $ tb --dry-run --model x/y // after $ tb --model x/y # --dry-run is not supported; see tb --help
Defensive patterns
Strategy: try-catch
Validate before calling
const KNOWN = new Set(["-m","--model","--attempts","--concurrency","--epochs","--budget","--gateway-url","--gateway-token","--openrouter-variant","--rebuild-agent","-h","--help"]);
const unknown = args.filter((a, i) => a.startsWith("-") && !KNOWN.has(a));
if (unknown.length) console.warn("unknown flags:", unknown); Try / catch
try {
config = parseArgs(args);
} catch (err) {
if (String(err.message).startsWith("unknown option:")) {
console.error(`${err.message} — run 'tb --help' for supported flags`);
process.exit(2);
}
throw err;
} Prevention
- Run tb --help after upgrading metaharness to catch renamed flags
- Keep launch scripts in sync with documented flags
- Avoid passing dash-prefixed tokens where values are expected
When it happens
Trigger: Passing a flag the CLI does not define (e.g. --verbose, --epochs=2 misspelled as --epoch), or a stray '-'-prefixed token left where an option value was expected after a previous take() consumed the wrong token.
Common situations: Renamed flags across metaharness versions (old scripts using removed flags); muscle-memory flags from other CLIs (--dry-run); accidentally passing a negative number or dash-prefixed token as a value.
Related errors
- missing value for ${flag}
- missing value for ${arg}
- missing operand
- Expected --${name} to be a positive integer, got ${value}
- Cache flags require --cache
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/24f8f4d11ed2d8ae.
Report an issue: GitHub.