nodejs/node · error
expected parameter for argument -%c\n
Error message
expected parameter for argument -%c\n
What it means
For parameterized short options (`o/q/w/C/D/S`) brotli requires the option letter to be the LAST character in a bundled short-option token so the next argv element is consumed as its parameter. The check `j + 1 != arg_len` fails when a parameter-requiring letter is followed by more letters in the same token, e.g. `-oq`. The parser will not split the remainder as an inline value.
Source
Thrown at deps/brotli/c/tools/brotli.c:438
/* Don't parse further. */
return COMMAND_VERSION;
} else if (c == 'Z') {
if (quality_set) {
fprintf(stderr, "quality already set\n");
return COMMAND_INVALID;
}
quality_set = BROTLI_TRUE;
params->quality = 11;
continue;
}
/* o/q/w/C/D/S with parameter is expected */
if (c != 'o' && c != 'q' && c != 'w' && c != 'C' && c != 'D' &&
c != 'S') {
fprintf(stderr, "invalid argument -%c\n", c);
return COMMAND_INVALID;
}
if (j + 1 != arg_len) {
fprintf(stderr, "expected parameter for argument -%c\n", c);
return COMMAND_INVALID;
}
i++;
if (i == argc || !argv[i] || argv[i][0] == 0) {
fprintf(stderr, "expected parameter for argument -%c\n", c);
return COMMAND_INVALID;
}
params->not_input_indices[next_option_index++] = i;
if (c == 'o') {
if (output_set) {
fprintf(stderr, "write to standard output already set (-o)\n");
return COMMAND_INVALID;
}
params->output_path = argv[i];
} else if (c == 'q') {
if (quality_set) {
fprintf(stderr, "quality already set\n");
return COMMAND_INVALID;View on GitHub (pinned to 1b2de5e052)
Solutions
- Move the parameterized option to the end of the bundle so its argument is the next token: `brotli -do out file`.
- Better: separate it entirely, `brotli -d -o out file`.
- Never put a letter after `-o`, `-q`, `-w`, `-C`, `-D`, or `-S` inside one token.
Example fix
# before brotli -doq out in.br # after brotli -d -o out in.br
Defensive patterns
Strategy: validation
Validate before calling
# bash: ensure parameterized short opts (o q w C D S) are terminal in any bundle
for a in "$@"; do
case "$a" in
-?*)
[ "${a:0:1}" = - ] && [ "${a:1:1}" != - ] || continue
b=${a#-}
case "$b" in
*o*|*q*|*w*|*C*|*D*|*S*)
last=${b: -1}
case "$last" in o|q|w|C|D|S) ;; *) echo "param option not terminal in $a" >&2; exit 2;; esac
;;
esac
;;
esac
done
brotli "$@" Try / catch
# bash if ! brotli "$@"; then rc=$?; echo "brotli exit $rc; check bundling" >&2; exit "$rc"; fi
Prevention
- Never place a parameterized option (-o,-q,-w,-C,-D,-S) before other letters in a bundle.
- When in doubt, separate flags: `brotli -d -o out in`.
When it happens
Trigger: Bundling a parameterized option before other letters: `brotli -doq out file`, `brotli -qf 11`.
Common situations: Habit from tools that allow `-oVALUE` inline; refactoring flag order in a generated command line.
Related errors
- too many options passed
- quality already set
- write to standard output already set
- command already set when parsing -d
- force output overwrite already set\n
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/6c34d32d7d66400e.
Report an issue: GitHub.