{"record":{"id":"cf87dd91bb22ee5d","repo":"apache/hadoop","slug":"invalid-parameter-range-name-value-max","errorCode":null,"errorMessage":"Invalid parameter range: {name} = {value} > {max}","messagePattern":"Invalid parameter range: (.+?) = (.+?) > (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/resources/IntegerParam.java","lineNumber":37,"sourceCode":"\n/** Integer parameter. */\nabstract class IntegerParam extends Param<Integer, IntegerParam.Domain> {\n  IntegerParam(final Domain domain, final Integer value,\n      final Integer min, final Integer max) {\n    super(domain, value);\n    checkRange(min, max);\n  }\n\n  private void checkRange(final Integer min, final Integer max) {\n    if (value == null) {\n      return;\n    }\n    if (min != null && value < min) {\n      throw new IllegalArgumentException(\"Invalid parameter range: \" + getName()\n          + \" = \" + domain.toString(value) + \" < \" + domain.toString(min));\n    }\n    if (max != null && value > max) {\n      throw new IllegalArgumentException(\"Invalid parameter range: \" + getName()\n          + \" = \" + domain.toString(value) + \" > \" + domain.toString(max));\n    }\n  }\n\n  @Override\n  public String toString() {\n    return getName() + \"=\" + domain.toString(getValue());\n  }\n\n  /** @return the parameter value as a string */\n  @Override\n  public String getValueString() {\n    return domain.toString(getValue());\n  }\n\n  /** The domain of the parameter. */\n  static final class Domain extends Param.Domain<Integer> {\n    /** The radix of the number. */","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/resources/IntegerParam.java#L19-L55","documentation":"The upper-bound half of IntegerParam.checkRange (IntegerParam.java:33-39): a non-null integer parameter value above the subclass maximum throws this IllegalArgumentException (HTTP 400). Note: no built-in WebHDFS IntegerParam subclass in this repository declares a max (BufferSizeParam and SnapshotDiffIndexParam both pass null), so seeing this message in a stock cluster means a custom IntegerParam subclass, a fork, or a repackaged hadoop-hdfs-client is enforcing an upper limit.","triggerScenarios":"Constructing any custom IntegerParam subclass with a max (e.g. new MyParam(value) where MyLimitParam caps at N) and passing value > N; running against a vendor build that added an upper bound to buffersize or snapshotdiffindex.","commonSituations":"In-house extensions of the WebHDFS parameter framework (e.g. a throttling parameter with an upper bound); vendor distributions with extra parameter validation; tests that directly instantiate IntegerParam subclasses with (domain, value, min, max) tuples.","solutions":["Read the error text: it names the parameter and prints the offending value and the max, e.g. 'buffersize = 999999999 > ...'.","Lower the value to at or below the printed maximum, or omit the parameter to use the server default.","If this is your own IntegerParam subclass, re-check the max you pass to super(domain, value, min, max) and clamp before constructing."],"exampleFix":"// before (custom subclass)\nnew TtlParam(86_400_000 * 30);          // exceeds max=2147483647? no; exceeds custom max\n// after\nnew TtlParam(Math.min(userTtl, TtlParam.MAX));","handlingStrategy":"validation","validationCode":"// for custom IntegerParam subclasses\nstatic int clampToMax(int value, Integer max) {\n  return max != null && value > max ? max : value;\n}","typeGuard":"static boolean withinMax(Integer value, Integer max) { return value == null || max == null || value <= max; }","tryCatchPattern":null,"preventionTips":["When defining custom IntegerParam subclasses, document the (min, max) pair next to the parameter name.","Parse the error message for the printed max and enforce it client-side in the same constant."],"tags":["webhdfs","query-param","range-validation","integer","hdfs"],"backgroundTag":"query-parameter-out-of-range","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}