{"record":{"id":"22c8369e20e2ed46","repo":"nodejs/node","slug":"command-already-set-when-parsing-d","errorCode":null,"errorMessage":"command already set when parsing -d\n","messagePattern":"command already set when parsing -d\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/brotli/c/tools/brotli.c","lineNumber":357,"sourceCode":"        if (c >= '0' && c <= '9') {\n          if (quality_set) {\n            fprintf(stderr, \"quality already set\\n\");\n            return COMMAND_INVALID;\n          }\n          quality_set = BROTLI_TRUE;\n          params->quality = c - '0';\n          continue;\n        } else if (c == 'c') {\n          if (output_set) {\n            fprintf(stderr, \"write to standard output already set\\n\");\n            return COMMAND_INVALID;\n          }\n          output_set = BROTLI_TRUE;\n          params->write_to_stdout = BROTLI_TRUE;\n          continue;\n        } else if (c == 'd') {\n          if (command_set) {\n            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\");","sourceCodeStart":339,"sourceCodeEnd":375,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/brotli/c/tools/brotli.c#L339-L375","documentation":"brotli's command-mode flags are mutually exclusive: `-d` (decompress), `-t` (test integrity). Once a command mode is set, passing `-d` again is rejected.","triggerScenarios":"`brotli -d -t file`, `brotli -d -d file`, or a coalesced `brotli -dt file`.","commonSituations":"An alias that decompresses (`-d`) combined with a user-added `-t`; a wrapper merging two modes; misunderstanding that test and decompress cannot combine.","solutions":["Use exactly one command-mode flag.","Remove the conflicting mode from your alias or command."],"exampleFix":"// before\nbrotli -d -t file.br   # two command modes\n// after\nbrotli -t file.br      # test integrity only","handlingStrategy":"validation","validationCode":"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))]\nassert len(modes) <= 1, 'only one command mode (-d/-t) allowed'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pick one mode per invocation (compress, decompress, or test).","Audit aliases for hidden mode flags."],"tags":["brotli","cli","argument-parsing","mode"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}