{"record":{"id":"94e632e11583fcbf","repo":"can1357/oh-my-pi","slug":"missing-value-for-arg","errorCode":null,"errorMessage":"missing value for ${arg}","messagePattern":"missing value for (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/metaharness/src/tb/cli.ts","lineNumber":122,"sourceCode":"\t\tvmonUrl: \"http://xeon.internal:17970\",\n\t\tvmonToken: \"\",\n\t\tlist: false,\n\t\thelp: false,\n\t};\n\tlet modelsSpecified = false;\n\n\tfor (let i = 0; i < argv.length; i++) {\n\t\tlet arg = argv[i];\n\t\tlet inlineValue: string | null = null;\n\t\tconst equals = arg.startsWith(\"--\") ? arg.indexOf(\"=\") : -1;\n\t\tif (equals !== -1) {\n\t\t\tinlineValue = arg.slice(equals + 1);\n\t\t\targ = arg.slice(0, equals);\n\t\t}\n\t\tconst take = (): string => {\n\t\t\tif (inlineValue !== null) return inlineValue;\n\t\t\tconst value = argv[++i];\n\t\t\tif (value === undefined) throw new Error(`missing value for ${arg}`);\n\t\t\treturn value;\n\t\t};\n\t\tswitch (arg) {\n\t\t\tcase \"-m\":\n\t\t\tcase \"--model\":\n\t\t\t\tif (!modelsSpecified) {\n\t\t\t\t\tconfig.models = [];\n\t\t\t\t\tmodelsSpecified = true;\n\t\t\t\t}\n\t\t\t\tconfig.models.push(take());\n\t\t\t\tbreak;\n\t\t\tcase \"--dataset\":\n\t\t\t\tconfig.dataset = take();\n\t\t\t\tbreak;\n\t\t\tcase \"-i\":\n\t\t\tcase \"--include\":\n\t\t\t\tconfig.include.push(take());\n\t\t\t\tbreak;","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/metaharness/src/tb/cli.ts#L104-L140","documentation":"The CLI arg parser's take() helper returns an option's value: either an inline `--flag=value` value or the next argv entry. When the flag is last in argv with no inline value, the next token is undefined and this error is thrown naming the flag.","triggerScenarios":"Invoking e.g. `tb --model` (or -m, --gateway-url, --openrouter-variant, etc.) as the final argument with no following token and no `=` form.","commonSituations":"Truncated copy-paste of a command line; shell history trimming; scripts building argv where the value variable is empty and gets dropped by word splitting (e.g. unquoted empty shell variable).","solutions":["Append the missing value after the flag (e.g. `tb --model anthropic/claude-sonnet-4`)","Or use the inline form `--model=anthropic/claude-sonnet-4`","In scripts, quote variables so empty values are not dropped: tb --model \"$MODEL\""],"exampleFix":"// before\n$ tb --model\n// after\n$ tb --model anthropic/claude-sonnet-4","handlingStrategy":"validation","validationCode":"function hasValue(argv: string[], flag: string): boolean {\n  const i = argv.indexOf(flag);\n  return i === -1 || (i + 1 < argv.length && !argv[i + 1].startsWith(\"-\")) || flag.includes(\"=\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  config = parseArgs(process.argv.slice(2));\n} catch (err) {\n  if (String(err.message).startsWith(\"missing value for\")) {\n    console.error(`${err.message}; usage: tb --model <provider/model>`);\n    process.exit(2);\n  }\n  throw err;\n}","preventionTips":["Quote shell variables so empty values are preserved","Use the --flag=value inline form to bind values explicitly","Wrap CLI invocations in a usage-check script"],"tags":["cli","arguments","parsing"],"backgroundTag":"missing-argument-value","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}