{"record":{"id":"d915e4114b10c896","repo":"nodejs/node","slug":"lgwin-parameter-d-smaller-than-the-minimum-d","errorCode":null,"errorMessage":"lgwin parameter (%d) smaller than the minimum (%d)\\n","messagePattern":"lgwin parameter \\((.+?)\\) smaller than the minimum \\((.+?)\\)\\\\n","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/brotli/c/tools/brotli.c","lineNumber":476,"sourceCode":"          quality_set = ParseInt(argv[i], BROTLI_MIN_QUALITY,\n                                 BROTLI_MAX_QUALITY, &params->quality);\n          if (!quality_set) {\n            fprintf(stderr, \"error parsing quality value [%s]\\n\", argv[i]);\n            return COMMAND_INVALID;\n          }\n        } else if (c == 'w') {\n          if (lgwin_set) {\n            fprintf(stderr, \"lgwin parameter already set\\n\");\n            return COMMAND_INVALID;\n          }\n          lgwin_set = ParseInt(argv[i], 0,\n                               BROTLI_MAX_WINDOW_BITS, &params->lgwin);\n          if (!lgwin_set) {\n            fprintf(stderr, \"error parsing lgwin value [%s]\\n\", argv[i]);\n            return COMMAND_INVALID;\n          }\n          if (params->lgwin != 0 && params->lgwin < BROTLI_MIN_WINDOW_BITS) {\n            fprintf(stderr,\n                    \"lgwin parameter (%d) smaller than the minimum (%d)\\n\",\n                    params->lgwin, BROTLI_MIN_WINDOW_BITS);\n            return COMMAND_INVALID;\n          }\n        } else if (c == 'C') {\n          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\");","sourceCodeStart":458,"sourceCodeEnd":494,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/brotli/c/tools/brotli.c#L458-L494","documentation":"After a successful `ParseInt`, brotli enforces a second constraint: if `lgwin != 0` it must be `>= BROTLI_MIN_WINDOW_BITS` (10). `0` is allowed (means 'use default'). Values like `1..9` print `lgwin parameter (<v>) smaller than the minimum (<min>)` and abort. This guards against an effectively-useless tiny window.","triggerScenarios":"`brotli -w 5 in`, `brotli -w 9 in`, or any value in `1..9`.","commonSituations":"Confusing lgwin with quality (`-w 5` thinking 'quality 5'); auto-tuned config generating tiny numbers; copy-pasting a value tuned for a different compressor.","solutions":["Use `0` for the default window, or a value in [10, BROTLI_MAX_WINDOW_BITS] (typically [10, 24]).","Re-read `brotli --help` for the lgwin range before picking a number.","Clamp the source variable to the valid band."],"exampleFix":"# before\nbrotli -w 5 in\n# after\nbrotli -w 0 in","handlingStrategy":"validation","validationCode":"# bash: lgwin must be 0 or in [10, MAXW]\nMINW=10; MAXW=24\nargv=(\"$@\")\nfor ((i=0;i<${#argv[@]};i++)); do\n  if [ \"${argv[$i]}\" = -w ]; then\n    v=${argv[$((i+1))]:-}\n    if [ \"$v\" != 0 ] && { [ \"$v\" -lt \"$MINW\" ] || [ \"$v\" -gt \"$MAXW\" ]; }; then\n      echo \"lgwin $v out of [0] or [$MINW..$MAXW]\" >&2; exit 2\n    fi\n  fi\ndone\nbrotli \"$@\"","typeGuard":null,"tryCatchPattern":"# bash\nif ! brotli \"$@\"; then rc=$?; echo \"brotli exit $rc; check lgwin range\" >&2; exit \"$rc\"; fi","preventionTips":["Use `-w 0` for the default window rather than guessing a small number.","Do not conflate lgwin with quality magnitude."],"tags":["cli","brotli","argument-parsing","lgwin","out-of-range"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}