nodejs/node · error
quality already set\n
Error message
quality already set\n
What it means
`-Z` is a shortcut that pins compression quality to 11 (the maximum). The parser latches quality via `quality_set`, shared with `-q`, `--best`, and another `-Z`. Supplying `-Z` after any quality-affecting option triggers this message and returns COMMAND_INVALID.
Source
Thrown at deps/brotli/c/tools/brotli.c:424
fprintf(stderr, "argument --verbose / -v already set\n");
return COMMAND_INVALID;
}
params->verbosity = 1;
continue;
} else if (c == 'K') {
if (concatenated_set) {
fprintf(stderr, "argument -K / --concatenated already set\n");
return COMMAND_INVALID;
}
concatenated_set = BROTLI_TRUE;
params->allow_concatenated = BROTLI_TRUE;
continue;
} else if (c == 'V') {
/* 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) {View on GitHub (pinned to 1b2de5e052)
Solutions
- Drop one quality setter: keep either `-Z`/`--best`/`-q 11` or an explicit `-q N`, not several.
- Audit build scripts that hard-code a quality flag and parameterize it instead.
Example fix
# before brotli -Z -q 9 in.txt # after brotli -q 11 in.txt
Defensive patterns
Strategy: validation
Validate before calling
# bash: count quality setters (-Z, --best, -q, --quality) q=$(printf '%s\n' "$@" | grep -cE '^(-Z|--best|-q|--quality.*)$') if [ "$q" -gt 1 ]; then echo "multiple quality flags" >&2; exit 2; fi brotli "$@"
Try / catch
# bash if ! brotli "$@"; then rc=$?; echo "brotli exit $rc" >&2; exit "$rc"; fi
Prevention
- Centralize the quality value in one variable and emit a single flag.
- Prefer `-q "$Q"` over mixing `-Z`/`--best` with explicit numbers.
When it happens
Trigger: Passing `-Z` together with another quality setter: `brotli -Z -q 9 f`, `brotli --best -Z f`, or `brotli -Z -Z f`.
Common situations: Preset wrappers that always add `-Z` while a user also passes `-q`; migrating from `gzip -9` habits and adding both `-Z` and an explicit quality.
Related errors
- argument -K / --concatenated already set\n
- write to standard output already set (-o)\n
- error parsing quality value [%s]\n
- lgwin parameter already set\n
- comment already set\n
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/a7e7b0947c0d9637.
Report an issue: GitHub.