nodejs/node · error

force output overwrite already set\n

Error message

force output overwrite already set\n

What it means

The brotli `-f`/`--force` flag forces overwriting existing output files. It may be set only once; a second occurrence is rejected.

Source

Thrown at deps/brotli/c/tools/brotli.c:365

        } else if (c == 'c') {
          if (output_set) {
            fprintf(stderr, "write to standard output already set\n");
            return COMMAND_INVALID;
          }
          output_set = BROTLI_TRUE;
          params->write_to_stdout = BROTLI_TRUE;
          continue;
        } else if (c == 'd') {
          if (command_set) {
            fprintf(stderr, "command already set when parsing -d\n");
            return COMMAND_INVALID;
          }
          command_set = BROTLI_TRUE;
          command = COMMAND_DECOMPRESS;
          continue;
        } else if (c == 'f') {
          if (params->force_overwrite) {
            fprintf(stderr, "force output overwrite already set\n");
            return COMMAND_INVALID;
          }
          params->force_overwrite = BROTLI_TRUE;
          continue;
        } else if (c == 'h') {
          /* Don't parse further. */
          return COMMAND_HELP;
        } else if (c == 'j' || c == 'k') {
          if (keep_set) {
            fprintf(stderr, "argument --rm / -j or --keep / -k already set\n");
            return COMMAND_INVALID;
          }
          keep_set = BROTLI_TRUE;
          params->junk_source = TO_BROTLI_BOOL(c == 'j');
          continue;
        } else if (c == 'n') {
          if (!params->copy_stat) {
            fprintf(stderr, "argument --no-copy-stat / -n already set\n");

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Remove the duplicate `-f`.
  2. De-duplicate short flags when constructing argv.

Example fix

// before
brotli -f -f file
// after
brotli -f file
Defensive patterns

Strategy: validation

Validate before calling

assert sum(1 for a in argv if a in ('-f','--force') or (a.startswith('-') and not a.startswith('--') and 'f' in a)) <= 1

Prevention

When it happens

Trigger: Passing `-f` twice: `brotli -f -f file` or coalesced `brotli -ff file`.

Common situations: Alias + explicit duplicate; flag groups concatenated by a wrapper.

Related errors


AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13). Data as JSON: /api/errors/ffa7b7fe5852db90. Report an issue: GitHub.