nodejs/node · error
must pass the parameter as --%s=value\n
Error message
must pass the parameter as --%s=value\n
What it means
For long options that take values (`--comment`, `--dictionary`, `--lgwin`, `--large_window`, `--output`, `--quality`, `--suffix`), the brotli CLI requires the `--key=value` form. If the parser finds no `=` in the token, or finds `=` as the last character (empty value), it prints the offending token and returns COMMAND_INVALID. Unlike getopt-style tools, brotli does not consume the next argv as the value.
Source
Thrown at deps/brotli/c/tools/brotli.c:596
return COMMAND_INVALID;
}
command_set = BROTLI_TRUE;
command = COMMAND_TEST_INTEGRITY;
} else if (strcmp("verbose", arg) == 0) {
if (params->verbosity > 0) {
fprintf(stderr, "argument --verbose / -v already set\n");
return COMMAND_INVALID;
}
params->verbosity = 1;
} else if (strcmp("version", arg) == 0) {
/* Don't parse further. */
return COMMAND_VERSION;
} else {
/* key=value */
const char* value = strchr(arg, '=');
size_t key_len;
if (!value || value[1] == 0) {
fprintf(stderr, "must pass the parameter as --%s=value\n", arg);
return COMMAND_INVALID;
}
key_len = (size_t)(value - arg);
value++;
if (strncmp("comment", arg, key_len) == 0) {
if (comment_set) {
fprintf(stderr, "comment already set\n");
return COMMAND_INVALID;
}
params->comment_len = MAX_COMMENT_LEN;
if (!ParseBase64(value, params->comment, ¶ms->comment_len)) {
fprintf(stderr, "invalid base64-encoded comment\n");
return COMMAND_INVALID;
}
comment_set = BROTLI_TRUE;
} else if (strncmp("dictionary", arg, key_len) == 0) {
if (params->dictionary_path) {
fprintf(stderr, "dictionary path already set\n");View on GitHub (pinned to 1b2de5e052)
Solutions
- Rewrite the flag as `--key=value`, e.g. `--lgwin=22`, `--quality=11`, `--suffix=.br`.
- For single-letter equivalents, use the space form (`-w 22`, `-q 11`, `-S .br`) which brotli does accept.
- In scripts, build args with the literal `=` to avoid whitespace splits.
Example fix
# before brotli --lgwin 22 --quality 11 input.txt -o input.txt.br # after brotli --lgwin=22 --quality=11 input.txt -o input.txt.br
Defensive patterns
Strategy: validation
Validate before calling
# Require --key=value form for value-taking long options.
value_opts='^(--comment|--dictionary|--lgwin|--large_window|--output|--quality|--suffix)='
for a in "$@"; do
case "$a" in
--comment|--dictionary|--lgwin|--large_window|--output|--quality|--suffix)
echo "flag needs =value: $a" >&2; exit 2 ;;
--comment=*|--dictionary=*|--lgwin=*|--large_window=*|--output=*|--quality=*|--suffix=*)
: ;; # well-formed
--comment*|--dictionary*|--lgwin*|--large_window*|--output*|--quality*|--suffix*)
echo "long option must use = form: $a" >&2; exit 2 ;;
esac
done Prevention
- Always pair long value options with `=`; reserve the space-separated form for short options (`-w 22`).
- When building arg lists in scripts, use the literal `key=value` join, not two list elements.
- Read `brotli --help` to learn which long options take values.
When it happens
Trigger: Invoking `brotli --lgwin 22 file` (space-separated), `brotli --quality=` (empty value), or `brotli --suffix .br` instead of `--suffix=.br`.
Common situations: Users transferring habits from GNU tools that accept `--flag value`; scripting that constructs args via list join without inserting `=`; typos dropping the `=`.
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/feb8bed1c98cfb8e.
Report an issue: GitHub.