nodejs/node · error
suffix already set\n
Error message
suffix already set\n
What it means
`-S SUFFIX` overrides the default `.br` suffix used when generating output file names. The parser latches it via `suffix_set`; a second `-S` is rejected to keep the output name unambiguous.
Source
Thrown at deps/brotli/c/tools/brotli.c:500
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");
return COMMAND_INVALID;
}
params->dictionary_path = argv[i];
} else if (c == 'S') {
if (suffix_set) {
fprintf(stderr, "suffix already set\n");
return COMMAND_INVALID;
}
suffix_set = BROTLI_TRUE;
params->suffix = argv[i];
}
}
} else { /* Double-dash. */
arg = &arg[2];
if (strcmp("best", arg) == 0) {
if (quality_set) {
fprintf(stderr, "quality already set\n");
return COMMAND_INVALID;
}
quality_set = BROTLI_TRUE;
params->quality = 11;
} else if (strcmp("concatenated", arg) == 0) {
if (concatenated_set) {
fprintf(stderr, "argument -K / --concatenated already set\n");View on GitHub (pinned to 1b2de5e052)
Solutions
- Pass `-S` exactly once with the desired suffix.
- Drop any wrapper-injected `-S` when the user supplies one.
Example fix
# before brotli -S .br -S .brotli in # after brotli -S .brotli in
Defensive patterns
Strategy: validation
Validate before calling
# bash: at most one suffix setter s=$(printf '%s\n' "$@" | grep -cE '^(-S|--suffix=.*)$') if [ "$s" -gt 1 ]; then echo "multiple suffix flags" >&2; exit 2; fi brotli "$@"
Try / catch
# bash if ! brotli "$@"; then rc=$?; echo "brotli exit $rc; dedupe suffix flags" >&2; exit "$rc"; fi
Prevention
- Centralize the suffix choice in a single variable.
- Drop wrapper-injected `-S` when the user supplies one.
When it happens
Trigger: `brotli -S .br -S .brotli in`, or `-S` combined with `--suffix=...`.
Common situations: Cross-platform scripts that set a default suffix colliding with an explicit one; migrating suffix conventions.
Related errors
- argument -K / --concatenated already set\n
- quality already set\n
- write to standard output already set (-o)\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/ac5251403d8a1b5c.
Report an issue: GitHub.