openai/codex-plugin-cc · error · Error
Missing value for -${shortKey}
Error message
Missing value for -${shortKey} What it means
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.
Source
Thrown at plugins/codex/scripts/lib/args.mjs:63
continue;
}
positionals.push(token);
continue;
}
const shortKey = token.slice(1);
const key = aliasMap[shortKey] ?? shortKey;
if (booleanOptions.has(key)) {
options[key] = true;
continue;
}
if (valueOptions.has(key)) {
const nextValue = argv[index + 1];
if (nextValue === undefined) {
throw new Error(`Missing value for -${shortKey}`);
}
options[key] = nextValue;
index += 1;
continue;
}
positionals.push(token);
}
return { options, positionals };
}
export function splitRawArgumentString(raw) {
const tokens = [];
let current = "";
let quote = null;
let escaping = false;
View on GitHub (pinned to db52e28f4d)
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.
Example fix
// before
parseArgs(['-m'], { valueOptions: ['m'] }) // throws
// after
parseArgs(['-m', 'gpt-5'], { valueOptions: ['m'] })
// note: short options do NOT support '-m=gpt-5' inline syntax Defensive patterns
Strategy: validation
Validate before calling
function validateShortValueOptions(argv, valueOptions, aliasMap = {}) {
const set = new Set(valueOptions);
for (let i = 0; i < argv.length; i += 1) {
const t = argv[i];
if (/^-[a-zA-Z]$/.test(t)) {
const key = aliasMap[t.slice(1)] ?? t.slice(1);
if (set.has(key)) {
const next = argv[i + 1];
if (next === undefined) {
throw new Error(`Missing value for ${t} (caught pre-parse)`);
}
}
}
}
} Type guard
null
Try / catch
null
Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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).
Related errors
- Missing value for --${rawKey}
- Usage: node scripts/app-server-broker.mjs serve --endpoint <
- Missing required --endpoint.
- Unsupported reasoning effort "${effort}". Use one of: none,
- Choose either --enable-review-gate or --disable-review-gate.
AI-assisted analysis of openai/codex-plugin-cc@db52e28f4d (2026-08-13).
Data as JSON: /api/errors/d77b08bacd55b6df.
Report an issue: GitHub.