{"record":{"id":"ac5251403d8a1b5c","repo":"nodejs/node","slug":"suffix-already-set-n","errorCode":null,"errorMessage":"suffix already set\\n","messagePattern":"suffix already set\\\\n","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/brotli/c/tools/brotli.c","lineNumber":500,"sourceCode":"          if (comment_set) {\n            fprintf(stderr, \"comment already set\\n\");\n            return COMMAND_INVALID;\n          }\n          params->comment_len = MAX_COMMENT_LEN;\n          if (!ParseBase64(argv[i], params->comment, &params->comment_len)) {\n            fprintf(stderr, \"invalid base64-encoded comment\\n\");\n            return COMMAND_INVALID;\n          }\n          comment_set = BROTLI_TRUE;\n        } else if (c == 'D') {\n          if (params->dictionary_path) {\n            fprintf(stderr, \"dictionary path already set\\n\");\n            return COMMAND_INVALID;\n          }\n          params->dictionary_path = argv[i];\n        } else if (c == 'S') {\n          if (suffix_set) {\n            fprintf(stderr, \"suffix already set\\n\");\n            return COMMAND_INVALID;\n          }\n          suffix_set = BROTLI_TRUE;\n          params->suffix = argv[i];\n        }\n      }\n    } else {  /* Double-dash. */\n      arg = &arg[2];\n      if (strcmp(\"best\", arg) == 0) {\n        if (quality_set) {\n          fprintf(stderr, \"quality already set\\n\");\n          return COMMAND_INVALID;\n        }\n        quality_set = BROTLI_TRUE;\n        params->quality = 11;\n      } else if (strcmp(\"concatenated\", arg) == 0) {\n        if (concatenated_set) {\n          fprintf(stderr, \"argument -K / --concatenated already set\\n\");","sourceCodeStart":482,"sourceCodeEnd":518,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/brotli/c/tools/brotli.c#L482-L518","documentation":"`-S SUFFIX` overrides the default `.br` suffix used when generating output file names. The parser latches it via `suffix_set`; a second `-S` is rejected to keep the output name unambiguous.","triggerScenarios":"`brotli -S .br -S .brotli in`, or `-S` combined with `--suffix=...`.","commonSituations":"Cross-platform scripts that set a default suffix colliding with an explicit one; migrating suffix conventions.","solutions":["Pass `-S` exactly once with the desired suffix.","Drop any wrapper-injected `-S` when the user supplies one."],"exampleFix":"# before\nbrotli -S .br -S .brotli in\n# after\nbrotli -S .brotli in","handlingStrategy":"validation","validationCode":"# bash: at most one suffix setter\ns=$(printf '%s\\n' \"$@\" | grep -cE '^(-S|--suffix=.*)$')\nif [ \"$s\" -gt 1 ]; then echo \"multiple suffix flags\" >&2; exit 2; fi\nbrotli \"$@\"","typeGuard":null,"tryCatchPattern":"# bash\nif ! brotli \"$@\"; then rc=$?; echo \"brotli exit $rc; dedupe suffix flags\" >&2; exit \"$rc\"; fi","preventionTips":["Centralize the suffix choice in a single variable.","Drop wrapper-injected `-S` when the user supplies one."],"tags":["cli","brotli","argument-parsing","duplicate-flag","suffix"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}