{"record":{"id":"24f8f4d11ed2d8ae","repo":"can1357/oh-my-pi","slug":"unknown-option-arg","errorCode":null,"errorMessage":"unknown option: ${arg}","messagePattern":"unknown option: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/metaharness/src/tb/cli.ts","lineNumber":196,"sourceCode":"\t\t\t}\n\t\t\tcase \"--rebuild-agent\":\n\t\t\t\tconfig.rebuildAgent = true;\n\t\t\t\tbreak;\n\t\t\tcase \"--vmon-url\":\n\t\t\t\tconfig.vmonUrl = take();\n\t\t\t\tbreak;\n\t\t\tcase \"--vmon-token\":\n\t\t\t\tconfig.vmonToken = take();\n\t\t\t\tbreak;\n\t\t\tcase \"--list\":\n\t\t\t\tconfig.list = true;\n\t\t\t\tbreak;\n\t\t\tcase \"-h\":\n\t\t\tcase \"--help\":\n\t\t\t\tconfig.help = true;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`unknown option: ${arg}`);\n\t\t}\n\t}\n\n\tif (config.help) return config;\n\tif (config.models.length === 0) throw new Error(\"at least one --model is required\");\n\tfor (const model of config.models) {\n\t\tconst slash = model.indexOf(\"/\");\n\t\tif (slash <= 0 || slash === model.length - 1) throw new Error(`invalid model ${model}; expected provider/model`);\n\t}\n\tfor (const [flag, value] of [\n\t\t[\"--attempts\", config.attempts],\n\t\t[\"--concurrency\", config.concurrency],\n\t\t[\"--epochs\", config.epochs],\n\t] as const) {\n\t\tif (!Number.isInteger(value) || value < 1) throw new Error(`${flag} must be a positive integer`);\n\t}\n\tif (config.budget !== null && (!Number.isFinite(config.budget) || config.budget < 0)) {\n\t\tthrow new Error(\"--budget must be a non-negative number\");","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/metaharness/src/tb/cli.ts#L178-L214","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\n$ tb --dry-run --model x/y\n// after\n$ tb --model x/y   # --dry-run is not supported; see tb --help","handlingStrategy":"try-catch","validationCode":"const KNOWN = new Set([\"-m\",\"--model\",\"--attempts\",\"--concurrency\",\"--epochs\",\"--budget\",\"--gateway-url\",\"--gateway-token\",\"--openrouter-variant\",\"--rebuild-agent\",\"-h\",\"--help\"]);\nconst unknown = args.filter((a, i) => a.startsWith(\"-\") && !KNOWN.has(a));\nif (unknown.length) console.warn(\"unknown flags:\", unknown);","typeGuard":null,"tryCatchPattern":"try {\n  config = parseArgs(args);\n} catch (err) {\n  if (String(err.message).startsWith(\"unknown option:\")) {\n    console.error(`${err.message} — run 'tb --help' for supported flags`);\n    process.exit(2);\n  }\n  throw err;\n}","preventionTips":["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"],"tags":["cli","arguments","parsing"],"backgroundTag":"unknown-cli-flag","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}