{"record":{"id":"6c34d32d7d66400e","repo":"nodejs/node","slug":"expected-parameter-for-argument-c-n","errorCode":null,"errorMessage":"expected parameter for argument -%c\\n","messagePattern":"expected parameter for argument -%c\\\\n","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/brotli/c/tools/brotli.c","lineNumber":438,"sourceCode":"          /* Don't parse further. */\n          return COMMAND_VERSION;\n        } else if (c == 'Z') {\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          continue;\n        }\n        /* o/q/w/C/D/S with parameter is expected */\n        if (c != 'o' && c != 'q' && c != 'w' && c != 'C' && c != 'D' &&\n            c != 'S') {\n          fprintf(stderr, \"invalid argument -%c\\n\", c);\n          return COMMAND_INVALID;\n        }\n        if (j + 1 != arg_len) {\n          fprintf(stderr, \"expected parameter for argument -%c\\n\", c);\n          return COMMAND_INVALID;\n        }\n        i++;\n        if (i == argc || !argv[i] || argv[i][0] == 0) {\n          fprintf(stderr, \"expected parameter for argument -%c\\n\", c);\n          return COMMAND_INVALID;\n        }\n        params->not_input_indices[next_option_index++] = i;\n        if (c == 'o') {\n          if (output_set) {\n            fprintf(stderr, \"write to standard output already set (-o)\\n\");\n            return COMMAND_INVALID;\n          }\n          params->output_path = argv[i];\n        } else if (c == 'q') {\n          if (quality_set) {\n            fprintf(stderr, \"quality already set\\n\");\n            return COMMAND_INVALID;","sourceCodeStart":420,"sourceCodeEnd":456,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/brotli/c/tools/brotli.c#L420-L456","documentation":"For parameterized short options (`o/q/w/C/D/S`) brotli requires the option letter to be the LAST character in a bundled short-option token so the next argv element is consumed as its parameter. The check `j + 1 != arg_len` fails when a parameter-requiring letter is followed by more letters in the same token, e.g. `-oq`. The parser will not split the remainder as an inline value.","triggerScenarios":"Bundling a parameterized option before other letters: `brotli -doq out file`, `brotli -qf 11`.","commonSituations":"Habit from tools that allow `-oVALUE` inline; refactoring flag order in a generated command line.","solutions":["Move the parameterized option to the end of the bundle so its argument is the next token: `brotli -do out file`.","Better: separate it entirely, `brotli -d -o out file`.","Never put a letter after `-o`, `-q`, `-w`, `-C`, `-D`, or `-S` inside one token."],"exampleFix":"# before\nbrotli -doq out in.br\n# after\nbrotli -d -o out in.br","handlingStrategy":"validation","validationCode":"# bash: ensure parameterized short opts (o q w C D S) are terminal in any bundle\nfor a in \"$@\"; do\n  case \"$a\" in\n    -?*) \n      [ \"${a:0:1}\" = - ] && [ \"${a:1:1}\" != - ] || continue\n      b=${a#-}\n      case \"$b\" in\n        *o*|*q*|*w*|*C*|*D*|*S*)\n          last=${b: -1}\n          case \"$last\" in o|q|w|C|D|S) ;; *) echo \"param option not terminal in $a\" >&2; exit 2;; esac\n          ;;\n      esac\n      ;;\n  esac\ndone\nbrotli \"$@\"","typeGuard":null,"tryCatchPattern":"# bash\nif ! brotli \"$@\"; then rc=$?; echo \"brotli exit $rc; check bundling\" >&2; exit \"$rc\"; fi","preventionTips":["Never place a parameterized option (-o,-q,-w,-C,-D,-S) before other letters in a bundle.","When in doubt, separate flags: `brotli -d -o out in`."],"tags":["cli","brotli","argument-parsing","bundled-options"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}