nodejs/node · error

argument -K / --concatenated already set\n

Error message

argument -K / --concatenated already set\n

What it means

The `-K` / `--concatenated` flag tells the brotli CLI to decompress files that are concatenations of multiple brotli streams; it sets `params->allow_concatenated`. A single `concatenated_set` latch guards it, and any second occurrence is a hard error that aborts parsing before any I/O. Brotli refuses ambiguous flag combinations rather than silently picking one.

Source

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

          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;
          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 */

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Remove the duplicate so `-K`/`--concatenated` appears exactly once.
  2. Make any wrapper that injects `-K` conditional: only add it when not already present in argv.
  3. Run `brotli --help` to confirm the flag's canonical spelling before reconstructing the command.

Example fix

# before
brotli -d -K -K in.br
# after
brotli -d -K in.br
Defensive patterns

Strategy: validation

Validate before calling

# bash: ensure -K / --concatenated appears at most once
occ=$(printf '%s\n' "$@" | grep -cE '^(-K|--concatenated)$')
if [ "$occ" -gt 1 ]; then echo "duplicate -K/--concatenated" >&2; exit 2; fi
brotli "$@"

Try / catch

# bash: detect brotli arg-validation failure
if ! brotli "$@"; then
  rc=$?
  echo "brotli failed (exit $rc); check stderr for the flag message" >&2
  exit "$rc"
fi

Prevention

When it happens

Trigger: Passing `-K` twice, or `-K` after `--concatenated` (short and long forms share the same latch), e.g. `brotli -d -K -K in.br` or `brotli --concatenated -K -d in.br`.

Common situations: A shell alias or wrapper script appends `-K` unconditionally while the user also typed it; merged copy-pasted command lines; CI matrix generators that concatenate flag lists.

Related errors


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