nodejs/node · error
lgwin parameter already set\n
Error message
lgwin parameter already set\n
What it means
`-w N` sets the brotli window size (`params->lgwin`); it is latched by `lgwin_set`, shared with `--lgwin` and `--large-window`-style setters. A second occurrence is rejected to avoid an ambiguous final value.
Source
Thrown at deps/brotli/c/tools/brotli.c:466
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;
}
} else if (c == 'C') {
if (comment_set) {
fprintf(stderr, "comment already set\n");
return COMMAND_INVALID;View on GitHub (pinned to 1b2de5e052)
Solutions
- Pass `-w`/`--lgwin` exactly once.
- Centralize window-size selection in one variable before building argv.
Example fix
# before brotli -w 22 -w 24 in # after brotli -w 24 in
Defensive patterns
Strategy: validation
Validate before calling
# bash: at most one window-size setter w=$(printf '%s\n' "$@" | grep -cE '^(-w|--lgwin|--large-window.*)$') if [ "$w" -gt 1 ]; then echo "multiple lgwin flags" >&2; exit 2; fi brotli "$@"
Try / catch
# bash if ! brotli "$@"; then rc=$?; echo "brotli exit $rc; dedupe lgwin flags" >&2; exit "$rc"; fi
Prevention
- Select the window size from a single variable.
- Avoid layering `--large-window` together with an explicit `-w`.
When it happens
Trigger: `brotli -w 22 -w 24 in`, or `-w 22 --lgwin 24 in`.
Common situations: Preset profiles merged into one command; tuning scripts that layer defaults over user input.
Related errors
- argument -K / --concatenated already set\n
- quality already set\n
- write to standard output already set (-o)\n
- error parsing lgwin value [%s]\n
- lgwin parameter (%d) smaller than the minimum (%d)\n
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/f42dc5118c90ee2b.
Report an issue: GitHub.