nodejs/node · error
lgwin parameter (%d) smaller than the minimum (%d)\n
Error message
lgwin parameter (%d) smaller than the minimum (%d)\n
What it means
After a successful `ParseInt`, brotli enforces a second constraint: if `lgwin != 0` it must be `>= BROTLI_MIN_WINDOW_BITS` (10). `0` is allowed (means 'use default'). Values like `1..9` print `lgwin parameter (<v>) smaller than the minimum (<min>)` and abort. This guards against an effectively-useless tiny window.
Source
Thrown at deps/brotli/c/tools/brotli.c:476
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;
}
} else if (c == 'C') {
if (comment_set) {
fprintf(stderr, "comment already set\n");
return COMMAND_INVALID;
}
params->comment_len = MAX_COMMENT_LEN;
if (!ParseBase64(argv[i], params->comment, ¶ms->comment_len)) {
fprintf(stderr, "invalid base64-encoded comment\n");
return COMMAND_INVALID;
}
comment_set = BROTLI_TRUE;
} else if (c == 'D') {
if (params->dictionary_path) {
fprintf(stderr, "dictionary path already set\n");View on GitHub (pinned to 1b2de5e052)
Solutions
- Use `0` for the default window, or a value in [10, BROTLI_MAX_WINDOW_BITS] (typically [10, 24]).
- Re-read `brotli --help` for the lgwin range before picking a number.
- Clamp the source variable to the valid band.
Example fix
# before brotli -w 5 in # after brotli -w 0 in
Defensive patterns
Strategy: validation
Validate before calling
# bash: lgwin must be 0 or in [10, MAXW]
MINW=10; MAXW=24
argv=("$@")
for ((i=0;i<${#argv[@]};i++)); do
if [ "${argv[$i]}" = -w ]; then
v=${argv[$((i+1))]:-}
if [ "$v" != 0 ] && { [ "$v" -lt "$MINW" ] || [ "$v" -gt "$MAXW" ]; }; then
echo "lgwin $v out of [0] or [$MINW..$MAXW]" >&2; exit 2
fi
fi
done
brotli "$@" Try / catch
# bash if ! brotli "$@"; then rc=$?; echo "brotli exit $rc; check lgwin range" >&2; exit "$rc"; fi
Prevention
- Use `-w 0` for the default window rather than guessing a small number.
- Do not conflate lgwin with quality magnitude.
When it happens
Trigger: `brotli -w 5 in`, `brotli -w 9 in`, or any value in `1..9`.
Common situations: Confusing lgwin with quality (`-w 5` thinking 'quality 5'); auto-tuned config generating tiny numbers; copy-pasting a value tuned for a different compressor.
Related errors
- lgwin parameter 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/d915e4114b10c896.
Report an issue: GitHub.