{"record":{"id":"aa48224cc0cd0b57","repo":"nodejs/node","slug":"quality-already-set","errorCode":null,"errorMessage":"quality already set\n","messagePattern":"quality already set\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/brotli/c/tools/brotli.c","lineNumber":341,"sourceCode":"    }\n\n    /* Not a file entry. */\n    params->not_input_indices[next_option_index++] = i;\n\n    /* '--' entry stop parsing arguments. */\n    if (arg_len == 2 && arg[1] == '-') {\n      after_dash_dash = BROTLI_TRUE;\n      continue;\n    }\n\n    /* Simple / coalesced options. */\n    if (arg[1] != '-') {\n      size_t j;\n      for (j = 1; j < arg_len; ++j) {\n        char c = arg[j];\n        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          }","sourceCodeStart":323,"sourceCodeEnd":359,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/brotli/c/tools/brotli.c#L323-L359","documentation":"The brotli CLI sets compression quality from a digit (e.g. `-9`, or a digit inside a coalesced short-option cluster). Quality may be set only once; a second digit/quality specifier is rejected as ambiguous.","triggerScenarios":"Passing two quality values, e.g. `brotli -9 -5 file`, a coalesced `brotli -95 file`, or `brotli -q 5 -9 file`.","commonSituations":"An alias or wrapper that already sets quality plus an explicit flag from the user; copy-pasted command lines combining two examples.","solutions":["Pass quality exactly once (either -q N or a single -N digit).","Remove the duplicate quality flag from your alias or script."],"exampleFix":"// before\nbrotli -9 -5 file.br   # quality set twice\n// after\nbrotli -9 file.br      # quality set once","handlingStrategy":"validation","validationCode":"# detect duplicate quality specifiers in argv before invoking brotli\nqs=[a for a in argv if a.startswith('-q')] + [a for a in argv if a.startswith('-') and any(c.isdigit() for c in a[1:])]\nassert len(qs) <= 1, 'quality specified more than once'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set quality in exactly one place (alias XOR explicit flag).","Avoid coalescing digits into short-option clusters."],"tags":["brotli","cli","argument-parsing","compression"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}