{"record":{"id":"fe0d245cbda62699","repo":"openai/codex-plugin-cc","slug":"missing-value-for-rawkey","errorCode":null,"errorMessage":"Missing value for --${rawKey}","messagePattern":"Missing value for --(.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"plugins/codex/scripts/lib/args.mjs","lineNumber":39,"sourceCode":"\n    if (!token.startsWith(\"-\") || token === \"-\") {\n      positionals.push(token);\n      continue;\n    }\n\n    if (token.startsWith(\"--\")) {\n      const [rawKey, inlineValue] = token.slice(2).split(\"=\", 2);\n      const key = aliasMap[rawKey] ?? rawKey;\n\n      if (booleanOptions.has(key)) {\n        options[key] = inlineValue === undefined ? true : inlineValue !== \"false\";\n        continue;\n      }\n\n      if (valueOptions.has(key)) {\n        const nextValue = inlineValue ?? argv[index + 1];\n        if (nextValue === undefined) {\n          throw new Error(`Missing value for --${rawKey}`);\n        }\n        options[key] = nextValue;\n        if (inlineValue === undefined) {\n          index += 1;\n        }\n        continue;\n      }\n\n      positionals.push(token);\n      continue;\n    }\n\n    const shortKey = token.slice(1);\n    const key = aliasMap[shortKey] ?? shortKey;\n\n    if (booleanOptions.has(key)) {\n      options[key] = true;\n      continue;","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/openai/codex-plugin-cc/blob/db52e28f4d9ded852ab3942cea316258ae4ef346/plugins/codex/scripts/lib/args.mjs#L21-L57","documentation":"Thrown by parseArgs when a long option registered in config.valueOptions appears as the last token with no value. The parser first looks for an inline value via '--key=value', then falls back to the next argv token; if both are absent (nextValue === undefined) it cannot satisfy a value-bearing option. This is a usage/contract error, not a runtime fault.","triggerScenarios":"Invoking parseArgs(argv, config) where config.valueOptions contains a key K, and argv ends with '--K' (or '--K' is followed only by a '--' passthrough marker or another already-consumed token). Example: parseArgs(['--model'], { valueOptions: ['model'] }) or parseArgs(['--model','--'], {...}) where '--' flips passthrough mode.","commonSituations":"A user forgets the argument to a flag such as --model, --base, --source, or --threadName. Shell quoting bugs strip an empty value. A dynamically-built command string drops the trailing value during templating.","solutions":["Supply the value inline: '--model=gpt-5' or as the next token: '--model gpt-5'.","If the option is genuinely optional, remove it from config.valueOptions or register it in config.booleanOptions instead.","When building argv programmatically, assert each value-option token is followed by a non-flag value before calling parseArgs.","If the flag was meant as a boolean switch, pass it through config.booleanOptions so '--flag' sets true."],"exampleFix":"// before\nparseArgs(['--model'], { valueOptions: ['model'] }) // throws\n\n// after\nparseArgs(['--model', 'gpt-5'], { valueOptions: ['model'] })\n// or\nparseArgs(['--model=gpt-5'], { valueOptions: ['model'] })","handlingStrategy":"validation","validationCode":"// Validate value-options are satisfied before parsing.\nfunction validateValueOptions(argv, valueOptions) {\n  const set = new Set(valueOptions);\n  for (let i = 0; i < argv.length; i += 1) {\n    const t = argv[i];\n    if (t.startsWith('--') && t !== '--') {\n      const [rawKey, inline] = t.slice(2).split('=', 2);\n      if (set.has(rawKey) && inline === undefined) {\n        const next = argv[i + 1];\n        if (next === undefined || next === '--' || next.startsWith('-')) {\n          throw new Error(`Missing value for --${rawKey} (caught pre-parse)`);\n        }\n      }\n    }\n  }\n}","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Define valueOptions and booleanOptions explicitly so the parser knows which flags need values.","When building argv programmatically, always pair a value-option flag with its value token.","Prefer inline '--key=value' for value options to avoid off-by-one argv issues.","Add a pre-parse validation pass in test harnesses for user-supplied command strings."],"tags":["cli","args-parsing","user-input"],"backgroundTag":null,"analyzedSha":"db52e28f4d9ded852ab3942cea316258ae4ef346","analyzedAt":"2026-08-13T05:13:20.855Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}