nodejs/node · error
error parsing quality value [%s]\n
Error message
error parsing quality value [%s]\n
What it means
`ParseInt` (brotli.c:228) accepts only 1–5 decimal digits, rejects leading zeros (e.g. `011`), and requires the value within `BROTLI_MIN_QUALITY..BROTLI_MAX_QUALITY` (0..11). If `-q`'s argument fails any of these checks, brotli prints `error parsing quality value [<arg>]` and aborts. The offending value is echoed in the message.
Source
Thrown at deps/brotli/c/tools/brotli.c:461
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;
}
quality_set = ParseInt(argv[i], BROTLI_MIN_QUALITY,
BROTLI_MAX_QUALITY, ¶ms->quality);
if (!quality_set) {
fprintf(stderr, "error parsing quality value [%s]\n", argv[i]);
return COMMAND_INVALID;
}
} else if (c == 'w') {
if (lgwin_set) {
fprintf(stderr, "lgwin parameter already set\n");
return COMMAND_INVALID;
}
lgwin_set = ParseInt(argv[i], 0,
BROTLI_MAX_WINDOW_BITS, ¶ms->lgwin);
if (!lgwin_set) {
fprintf(stderr, "error parsing lgwin value [%s]\n", argv[i]);
return COMMAND_INVALID;
}
if (params->lgwin != 0 && params->lgwin < BROTLI_MIN_WINDOW_BITS) {
fprintf(stderr,
"lgwin parameter (%d) smaller than the minimum (%d)\n",
params->lgwin, BROTLI_MIN_WINDOW_BITS);
return COMMAND_INVALID;View on GitHub (pinned to 1b2de5e052)
Solutions
- Use an integer in [0, 11] with no leading zeros, e.g. `-q 11`.
- If the value comes from a variable, clamp/validate it first: `Q=$(( Q>11?11:Q<0?0:Q ))`.
- For 'max' just use `-Z` or `--best` to avoid manual numbering.
Example fix
# before brotli -q 99 in # after brotli -q 11 in
Defensive patterns
Strategy: validation
Validate before calling
# bash: validate -q value (0..11, no leading zero, <=2 digits)
argv=("$@")
for ((i=0;i<${#argv[@]};i++)); do
if [ "${argv[$i]}" = -q ]; then
v=${argv[$((i+1))]:-}
if ! [[ "$v" =~ ^(0|[1-9][0-9]?)$ ]] || [ "$v" -gt 11 ]; then
echo "invalid quality '$v' (need 0..11, no leading zero)" >&2; exit 2
fi
fi
done
brotli "$@" Try / catch
# bash if ! brotli "$@"; then rc=$?; echo "brotli exit $rc; verify -q value" >&2; exit "$rc"; fi
Prevention
- Clamp source variables to [0,11] and strip leading zeros before passing.
- Use `-Z` for max to avoid manual numbering.
When it happens
Trigger: `brotli -q 99 in` (out of range), `brotli -q 011 in` (leading zero), `brotli -q abc in` (non-digit), `brotli -q 123456 in` (>5 digits), `brotli -q -5 in` (the `-5` is read as a flag, leaving `-q` without a value — actually yields the missing-parameter error, but `brotli -q ''` triggers this one).
Common situations: Porting `gzip -9` expectations (`-q 9` is fine but `>11` is not); passing floats like `-q 4.5`; negative numbers from a misconfigured variable.
Related errors
- quality already set\n
- error parsing lgwin value [%s]\n
- too many options passed
- quality already set
- write to standard output already set
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/1133fc6530e78151.
Report an issue: GitHub.