nodejs/node · error

command already set when parsing -t\n

Error message

command already set when parsing -t\n

What it means

`-t`/`--test` (test archive integrity) is a command mode mutually exclusive with `-d` (decompress). Once a command mode is set, passing `-t` again is rejected.

Source

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

          continue;
        } else if (c == 'n') {
          if (!params->copy_stat) {
            fprintf(stderr, "argument --no-copy-stat / -n already set\n");
            return COMMAND_INVALID;
          }
          params->copy_stat = BROTLI_FALSE;
          continue;
        } else if (c == 's') {
          if (squash_set) {
            fprintf(stderr, "argument --squash / -s already set\n");
            return COMMAND_INVALID;
          }
          squash_set = BROTLI_TRUE;
          params->reject_uncompressible = BROTLI_TRUE;
          continue;
        } else if (c == 't') {
          if (command_set) {
            fprintf(stderr, "command already set when parsing -t\n");
            return COMMAND_INVALID;
          }
          command_set = BROTLI_TRUE;
          command = COMMAND_TEST_INTEGRITY;
          continue;
        } else if (c == 'v') {
          if (params->verbosity > 0) {
            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;

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Use exactly one command-mode flag (`-t` or `-d`).
  2. Remove the conflicting mode from your alias or command.

Example fix

// before
brotli -t -d file.br   # two command modes
// after
brotli -t file.br      # test integrity only
Defensive patterns

Strategy: validation

Validate before calling

modes=[a for a in argv if a in ('-d','-t','--decompress','--test') or (a.startswith('-') and not a.startswith('--') and ('d' in a or 't' in a))]
assert len(modes) <= 1, 'only one command mode (-d/-t) allowed'

Prevention

When it happens

Trigger: `brotli -t -d file`, `brotli -t -t file`, or coalesced `brotli -td file`.

Common situations: Alias that tests (`-t`) plus a user `-d`; a wrapper merging modes; assuming test+decompress can combine.

Related errors


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