bazelbuild/bazel · error · OptionsParsingException
'" + input + "' should be >= " + minValue
Error message
'" + input + "' should be >= " + minValue
What it means
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.
Source
Thrown at src/main/java/com/google/devtools/common/options/Converters.java:472
}
}
/** Checks whether an integer is in the given range. */
public static class RangeConverter extends Converter.Contextless<Integer> {
final int minValue;
final int maxValue;
public RangeConverter(int minValue, int maxValue) {
this.minValue = minValue;
this.maxValue = maxValue;
}
@Override
public Integer convert(String input) throws OptionsParsingException {
try {
int value = Integer.parseInt(input);
if (value < minValue) {
throw new OptionsParsingException("'" + input + "' should be >= " + minValue);
} else if (value < minValue || value > maxValue) {
throw new OptionsParsingException("'" + input + "' should be <= " + maxValue);
}
return value;
} catch (NumberFormatException e) {
throw new OptionsParsingException("'" + input + "' is not an int", e);
}
}
@Override
public String getTypeDescription() {
if (minValue == Integer.MIN_VALUE) {
if (maxValue == Integer.MAX_VALUE) {
return "an integer";
} else {
return "an integer, <= " + maxValue;
}
} else if (maxValue == Integer.MAX_VALUE) {View on GitHub (pinned to e6e199d060)
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).
Example fix
# before bazel build --jobs=0 //... # after bazel build --jobs=1 //...
Defensive patterns
Strategy: validation
Validate before calling
boolean isInRange(String s, int min, int max) {
try { int v = Integer.parseInt(s); return v >= min && v <= max; }
catch (NumberFormatException | NullPointerException e) { return false; }
} Type guard
boolean isRangeFlagValue(String s, int min, int max) {
return s != null && s.matches("[+-]?[0-9]+")
&& isInRange(s, min, max);
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- '" + input + "' should be <= " + maxValue
- '" + input + "' is not a boolean
- '" + input + "' is not an int
- '" + input + "' is not a long
- '" + input + "' is not a double
AI-assisted analysis of bazelbuild/bazel@e6e199d060 (2026-08-14).
Data as JSON: /api/errors/e10363c9dd09e1b8.
Report an issue: GitHub.