{"record":{"id":"bb4d45ad5da6409a","repo":"nodejs/node","slug":"argument-no-copy-stat-n-already-set-n","errorCode":null,"errorMessage":"argument --no-copy-stat / -n already set\\n","messagePattern":"argument --no-copy-stat / -n already set\\\\n","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/brotli/c/tools/brotli.c","lineNumber":383,"sourceCode":"            fprintf(stderr, \"force output overwrite already set\\n\");\n            return COMMAND_INVALID;\n          }\n          params->force_overwrite = BROTLI_TRUE;\n          continue;\n        } else if (c == 'h') {\n          /* Don't parse further. */\n          return COMMAND_HELP;\n        } else if (c == 'j' || c == 'k') {\n          if (keep_set) {\n            fprintf(stderr, \"argument --rm / -j or --keep / -k already set\\n\");\n            return COMMAND_INVALID;\n          }\n          keep_set = BROTLI_TRUE;\n          params->junk_source = TO_BROTLI_BOOL(c == 'j');\n          continue;\n        } else if (c == 'n') {\n          if (!params->copy_stat) {\n            fprintf(stderr, \"argument --no-copy-stat / -n already set\\n\");\n            return COMMAND_INVALID;\n          }\n          params->copy_stat = BROTLI_FALSE;\n          continue;\n        } else if (c == 's') {\n          if (squash_set) {\n            fprintf(stderr, \"argument --squash / -s already set\\n\");\n            return COMMAND_INVALID;\n          }\n          squash_set = BROTLI_TRUE;\n          params->reject_uncompressible = BROTLI_TRUE;\n          continue;\n        } else if (c == 't') {\n          if (command_set) {\n            fprintf(stderr, \"command already set when parsing -t\\n\");\n            return COMMAND_INVALID;\n          }\n          command_set = BROTLI_TRUE;","sourceCodeStart":365,"sourceCodeEnd":401,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/brotli/c/tools/brotli.c#L365-L401","documentation":"`-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.","triggerScenarios":"Passing `-n` twice: `brotli -n -n file` or coalesced `brotli -nn file`.","commonSituations":"Alias + explicit duplicate; stacked short flags.","solutions":["Remove the duplicate `-n`.","Construct argv from a set to avoid stacking."],"exampleFix":"// before\nbrotli -n -n file\n// after\nbrotli -n file","handlingStrategy":"validation","validationCode":"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","typeGuard":null,"tryCatchPattern":null,"preventionTips":["State each toggle once.","De-duplicate flags in generated command lines."],"tags":["brotli","cli","argument-parsing"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}