{"record":{"id":"294e981adb366ffa","repo":"nodejs/node","slug":"argument-rm-j-or-keep-k-already-set-n","errorCode":null,"errorMessage":"argument --rm / -j or --keep / -k already set\\n","messagePattern":"argument --rm / -j or --keep / -k already set\\\\n","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/brotli/c/tools/brotli.c","lineNumber":375,"sourceCode":"            fprintf(stderr, \"command already set when parsing -d\\n\");\n            return COMMAND_INVALID;\n          }\n          command_set = BROTLI_TRUE;\n          command = COMMAND_DECOMPRESS;\n          continue;\n        } else if (c == 'f') {\n          if (params->force_overwrite) {\n            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;","sourceCodeStart":357,"sourceCodeEnd":393,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/brotli/c/tools/brotli.c#L357-L393","documentation":"`-j`/`--rm` (delete the source after success) and `-k`/`--keep` (keep the source) share a single keep/rm toggle and are mutually exclusive. Setting either a second time, or both, is rejected.","triggerScenarios":"`brotli -j -k file`, `brotli -k -k file`, `brotli -j -j file`, or coalesced `brotli -jk file`.","commonSituations":"Wanting contradictory behavior (keep AND remove); an alias that sets `-k` plus a user `-j`; wrapper concatenation.","solutions":["Choose one: keep the source (`-k`) or remove it (`-j`).","Remove the contradictory flag from your alias/script."],"exampleFix":"// before\nbrotli -j -k file.br   # contradictory\n// after\nbrotli -j file.br      # remove source after decompress","handlingStrategy":"validation","validationCode":"jk=[a for a in argv if a in ('-j','--rm','-k','--keep') or (a.startswith('-') and not a.startswith('--') and ('j' in a or 'k' in a))]\nassert len(jk) <= 1, '--rm/-j and --keep/-k are mutually exclusive'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Decide source retention once per invocation.","Do not combine -j and -k."],"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"}