{"record":{"id":"d77b08bacd55b6df","repo":"openai/codex-plugin-cc","slug":"missing-value-for-shortkey","errorCode":null,"errorMessage":"Missing value for -${shortKey}","messagePattern":"Missing value for -(.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"plugins/codex/scripts/lib/args.mjs","lineNumber":63,"sourceCode":"        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;\n    }\n\n    if (valueOptions.has(key)) {\n      const nextValue = argv[index + 1];\n      if (nextValue === undefined) {\n        throw new Error(`Missing value for -${shortKey}`);\n      }\n      options[key] = nextValue;\n      index += 1;\n      continue;\n    }\n\n    positionals.push(token);\n  }\n\n  return { options, positionals };\n}\n\nexport function splitRawArgumentString(raw) {\n  const tokens = [];\n  let current = \"\";\n  let quote = null;\n  let escaping = false;\n","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/openai/codex-plugin-cc/blob/db52e28f4d9ded852ab3942cea316258ae4ef346/plugins/codex/scripts/lib/args.mjs#L45-L81","documentation":"Thrown by parseArgs when a short option (single-dash, e.g. -m) registered in config.valueOptions is the last token with no following value. Unlike long options, short options never support inline '=' values, so the parser can only consume the next argv token; if that token is undefined (end of array) the value-bearing option is unsatisfiable.","triggerScenarios":"Calling parseArgs(argv, config) where config.valueOptions contains a single-character key K and argv ends with '-K'. Example: parseArgs(['-m'], { valueOptions: ['m'] }). Note the aliasMap may map short to long, so '-m' resolves via aliasMap['m'] before the valueOptions check.","commonSituations":"User types '-m' expecting a value but forgets it, or a wrapper script truncates the argument list. Confusing a boolean short flag with a value short flag (e.g. treating -v as verbose boolean vs -v as version value).","solutions":["Provide the value as the immediately following token: '-m gpt-5'.","If the short key is an alias, ensure config.aliasMap maps it to the correct long key that is itself in valueOptions.","If no value is intended, move the key into config.booleanOptions so '-K' sets true without consuming a token.","When constructing argv dynamically, verify each value short-option has a successor token."],"exampleFix":"// before\nparseArgs(['-m'], { valueOptions: ['m'] }) // throws\n\n// after\nparseArgs(['-m', 'gpt-5'], { valueOptions: ['m'] })\n// note: short options do NOT support '-m=gpt-5' inline syntax","handlingStrategy":"validation","validationCode":"function validateShortValueOptions(argv, valueOptions, aliasMap = {}) {\n  const set = new Set(valueOptions);\n  for (let i = 0; i < argv.length; i += 1) {\n    const t = argv[i];\n    if (/^-[a-zA-Z]$/.test(t)) {\n      const key = aliasMap[t.slice(1)] ?? t.slice(1);\n      if (set.has(key)) {\n        const next = argv[i + 1];\n        if (next === undefined) {\n          throw new Error(`Missing value for ${t} (caught pre-parse)`);\n        }\n      }\n    }\n  }\n}","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Remember short options never accept inline '=' values; always pass the next token.","Keep aliasMap in sync with valueOptions so short aliases resolve correctly.","Document short flags that consume values versus boolean short flags clearly.","Validate argv shape in CLI tests to catch regressions."],"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"}