{"record":{"id":"e5d89d89f87261eb","repo":"bazelbuild/bazel","slug":"input-should-be-maxvalue","errorCode":null,"errorMessage":"'\" + input + \"' should be <= \" + maxValue","messagePattern":"'\" \\+ input \\+ \"' should be <= \" \\+ maxValue","errorType":"validation","errorClass":"OptionsParsingException","httpStatus":null,"severity":"error","filePath":"src/main/java/com/google/devtools/common/options/Converters.java","lineNumber":474,"sourceCode":"\n  /** Checks whether an integer is in the given range. */\n  public static class RangeConverter extends Converter.Contextless<Integer> {\n    final int minValue;\n    final int maxValue;\n\n    public RangeConverter(int minValue, int maxValue) {\n      this.minValue = minValue;\n      this.maxValue = maxValue;\n    }\n\n    @Override\n    public Integer convert(String input) throws OptionsParsingException {\n      try {\n        int value = Integer.parseInt(input);\n        if (value < minValue) {\n          throw new OptionsParsingException(\"'\" + input + \"' should be >= \" + minValue);\n        } else if (value < minValue || value > maxValue) {\n          throw new OptionsParsingException(\"'\" + input + \"' should be <= \" + maxValue);\n        }\n        return value;\n      } catch (NumberFormatException e) {\n        throw new OptionsParsingException(\"'\" + input + \"' is not an int\", e);\n      }\n    }\n\n    @Override\n    public String getTypeDescription() {\n      if (minValue == Integer.MIN_VALUE) {\n        if (maxValue == Integer.MAX_VALUE) {\n          return \"an integer\";\n        } else {\n          return \"an integer, <= \" + maxValue;\n        }\n      } else if (maxValue == Integer.MAX_VALUE) {\n        return \"an integer, >= \" + minValue;\n      } else {","sourceCodeStart":456,"sourceCodeEnd":492,"githubUrl":"https://github.com/bazelbuild/bazel/blob/e6e199d0601a244511b4cf18c8b2828aa73db1fd/src/main/java/com/google/devtools/common/options/Converters.java#L456-L492","documentation":"Thrown by Converters.RangeConverter.convert when the parsed integer exceeds the converter's configured maxValue. It is the upper-bound counterpart of the 'should be >=' error: RangeConverter enforces both ends of a hard range at option-parse time and never clamps silently.","triggerScenarios":"Passing a value above the flag's documented maximum to a RangeConverter-backed option, e.g. --test_env=... style counts, verbosity indices beyond the level table, or --jobs=10000 past the cap.","commonSituations":"Copying aggressive tuning values from blog posts or other machines whose Bazel version allowed a higher cap; values meant for a different flag; automated scripts multiplying defaults by a factor that overshoots the bound.","solutions":["Pass a value <= the maximum quoted in the message.","Check the flag's type description (e.g. \"an integer, <= 2147483647\") for the enforced cap.","Clamp generated values in your scripts to the documented range."],"exampleFix":"# before\nbazel build --my_capped_flag=10000 //...\n# after\nbazel build --my_capped_flag=1000 //...   # max from the error message","handlingStrategy":"validation","validationCode":"boolean isInRange(String s, int min, int max) {\n  try { int v = Integer.parseInt(s); return v >= min && v <= max; }\n  catch (NumberFormatException | NullPointerException e) { return false; }\n}","typeGuard":"boolean isRangeFlagValue(String s, int min, int max) {\n  return s != null && s.matches(\"[+-]?[0-9]+\")\n      && isInRange(s, min, max);\n}","tryCatchPattern":null,"preventionTips":["Check the flag's type description for the enforced cap after upgrades.","Clamp tuned values (jobs, caches, sizes) to the documented maximum in wrapper scripts.","Treat 'should be <=' as a config review signal: aggressive values from other setups rarely transfer."],"tags":["bazel","options","converter","range","validation","cli"],"backgroundTag":null,"analyzedSha":"e6e199d0601a244511b4cf18c8b2828aa73db1fd","analyzedAt":"2026-08-14T10:24:27.848Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}