{"record":{"id":"e10363c9dd09e1b8","repo":"bazelbuild/bazel","slug":"input-should-be-minvalue","errorCode":null,"errorMessage":"'\" + input + \"' should be >= \" + minValue","messagePattern":"'\" \\+ input \\+ \"' should be >= \" \\+ minValue","errorType":"validation","errorClass":"OptionsParsingException","httpStatus":null,"severity":"error","filePath":"src/main/java/com/google/devtools/common/options/Converters.java","lineNumber":472,"sourceCode":"    }\n  }\n\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) {","sourceCodeStart":454,"sourceCodeEnd":490,"githubUrl":"https://github.com/bazelbuild/bazel/blob/e6e199d0601a244511b4cf18c8b2828aa73db1fd/src/main/java/com/google/devtools/common/options/Converters.java#L454-L490","documentation":"Thrown by Converters.RangeConverter.convert when the parsed integer is below the converter's configured minValue. RangeConverter is used for int options with a hard lower bound; values outside the bound are rejected at parse time instead of being clamped, and the message states the exact minimum expected.","triggerScenarios":"Passing a value smaller than the flag's documented minimum to a RangeConverter-backed option, e.g. --jobs=0 when the range starts at 1, or a negative value to a flag whose min is 0.","commonSituations":"Trying to disable a feature by passing 0 or -1 to a flag whose minimum disallows it; scripts computing values that occasionally undershoot; defaults copied from another tool with a wider range.","solutions":["Pass a value >= the minimum quoted in the message.","To disable the behavior, look for the flag's documented off-switch (a boolean companion flag) instead of an out-of-range sentinel.","Clamp computed values in scripts before passing them (e.g. MAX=1 for the lower bound)."],"exampleFix":"# before\nbazel build --jobs=0 //...\n# after\nbazel build --jobs=1 //...","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":["Clamp computed values to documented flag ranges before invocation.","Use companion boolean flags, not sentinel numbers, to disable features.","Centralize flag bounds in one config module shared by scripts and docs."],"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"}