nodejs/node · error
write to standard output already set (-o)\n
Error message
write to standard output already set (-o)\n
What it means
The `-o PATH` option sets the single output destination (`params->output_path`) and is latched by `output_set`. A second `-o` would leave the destination ambiguous, so brotli rejects it with COMMAND_INVALID. Note `-o` writes to a file path; do not confuse it with stdout (`-c`).
Source
Thrown at deps/brotli/c/tools/brotli.c:449
/* 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) {
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;View on GitHub (pinned to 1b2de5e052)
Solutions
- Keep exactly one `-o PATH`; remove the duplicate.
- For multiple inputs use output naming via suffix (`-S`) rather than `-o`.
- Strip any `-o` injected by aliases/functions before adding a user one.
Example fix
# before brotli -o a -o b in # after brotli -o b in
Defensive patterns
Strategy: validation
Validate before calling
# bash: at most one -o / --output o=$(printf '%s\n' "$@" | grep -cE '^(-o|--output.*)$') if [ "$o" -gt 1 ]; then echo "multiple output paths" >&2; exit 2; fi brotli "$@"
Try / catch
# bash if ! brotli "$@"; then rc=$?; echo "brotli exit $rc; check -o duplicates" >&2; exit "$rc"; fi
Prevention
- For multi-file runs use `-S` suffix output instead of `-o`.
- Strip alias-injected `-o` before adding a user-supplied one.
When it happens
Trigger: `brotli -o a -o b in`, or a wrapper plus a user both adding `-o`.
Common situations: Generated pipelines concatenating flag lists; an alias `brotli='brotli -o /tmp/out'` colliding with an explicit user `-o`.
Related errors
- write to standard output already set\n
- write to standard output already set
- argument -K / --concatenated already set\n
- quality already set\n
- lgwin parameter already set\n
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/c99f13bdcf5fd7ec.
Report an issue: GitHub.