nodejs/node · error
argument --no-copy-stat / -n already set\n
Error message
argument --no-copy-stat / -n already set\n
What it means
`-n`/`--no-copy-stat` tells brotli not to copy file metadata (permissions/timestamps) to the output. The parser rejects a second occurrence even though the effect is idempotent.
Source
Thrown at deps/brotli/c/tools/brotli.c:383
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");
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;View on GitHub (pinned to 1b2de5e052)
Solutions
- Remove the duplicate `-n`.
- Construct argv from a set to avoid stacking.
Example fix
// before brotli -n -n file // after brotli -n file
Defensive patterns
Strategy: validation
Validate before calling
assert sum(1 for a in argv if a in ('-n','--no-copy-stat') or (a.startswith('-') and not a.startswith('--') and 'n' in a)) <= 1 Prevention
- State each toggle once.
- De-duplicate flags in generated command lines.
When it happens
Trigger: Passing `-n` twice: `brotli -n -n file` or coalesced `brotli -nn file`.
Common situations: Alias + explicit duplicate; stacked short flags.
Related errors
- too many options passed
- quality already set
- write to standard output already set
- command already set when parsing -d
- force output overwrite already set\n
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/bb4d45ad5da6409a.
Report an issue: GitHub.