{"record":{"id":"0b70060f4c5649ac","repo":"nodejs/node","slug":"invalid-argument-c-n","errorCode":null,"errorMessage":"invalid argument -%c\\n","messagePattern":"invalid argument -%c\\\\n","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/brotli/c/tools/brotli.c","lineNumber":434,"sourceCode":"          concatenated_set = BROTLI_TRUE;\n          params->allow_concatenated = BROTLI_TRUE;\n          continue;\n        } else if (c == 'V') {\n          /* 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];","sourceCodeStart":416,"sourceCodeEnd":452,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/brotli/c/tools/brotli.c#L416-L452","documentation":"After all known single-letter options are exhausted, brotli checks whether the char is one of the parameterized options (`o/q/w/C/D/S`). If not, it is an unknown short option and the parser prints `invalid argument -<c>` and aborts. The char is interpolated into the message.","triggerScenarios":"Supplying an unsupported short flag, e.g. `brotli -x f`, `brotli -1 f` (brotli has no gzip-style `-1`), or a typo like `brotli -d -v` followed by stray chars.","commonSituations":"Carrying over gzip/zstd muscle memory (`-1`..`-9`, `-r`); typos; man-page / help from a different brotli version.","solutions":["Run `brotli --help` and replace the unknown short option with a supported equivalent.","For numeric quality use `-q N` (0..11) or `-Z`/`--best` instead of `-N`.","Check for shell alias expansion that may have injected the stray character."],"exampleFix":"# before\nbrotli -9 in.txt\n# after\nbrotli -q 9 in.txt","handlingStrategy":"validation","validationCode":"# bash: reject unknown short options\nknown='cdfhjkKntvVZoq wCDS'\nfor a in \"$@\"; do\n  case \"$a\" in\n    --*) ;;\n    -*)\n      rest=${a#-}\n      while [ -n \"$rest\" ]; do\n        c=${rest:0:1}; rest=${rest:1}\n        case \" \"$known\" \" in *\" \"$c \"*) ;; *) echo \"unknown -<$c>\" >&2; exit 2;; esac\n      done\n      ;;\n  esac\ndone\nbrotli \"$@\"","typeGuard":null,"tryCatchPattern":"# bash\nif ! brotli \"$@\"; then rc=$?; echo \"brotli exit $rc; check for unsupported flags\" >&2; exit \"$rc\"; fi","preventionTips":["Run `brotli --help` to enumerate valid short flags before scripting.","Avoid gzip-style numeric flags (-1..-9); brotli uses `-q N`."],"tags":["cli","brotli","argument-parsing","unknown-flag"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}