bazelbuild/bazel · error · OptionsParsingException
'" + input + "' is not an int
Error message
'" + input + "' is not an int
What it means
Thrown by Converters.IntegerConverter.convert when Integer.decode(input) raises NumberFormatException. decode() accepts decimal literals, 0x/#-prefixed hex, and 0-prefixed octal, but rejects everything else; the converter wraps the failure in an OptionsParsingException that names the offending input.
Source
Thrown at src/main/java/com/google/devtools/common/options/Converters.java:109
return null;
}
return input;
}
@Override
public String getTypeDescription() {
return "a string; empty to unset";
}
}
/** Standard converter for integers. */
public static class IntegerConverter extends Converter.Contextless<Integer> {
@Override
public Integer convert(String input) throws OptionsParsingException {
try {
return Integer.decode(input);
} catch (NumberFormatException e) {
throw new OptionsParsingException("'" + input + "' is not an int", e);
}
}
@Override
public String getTypeDescription() {
return "an integer";
}
}
/** Standard converter for longs. */
public static class LongConverter extends Converter.Contextless<Long> {
@Override
public Long convert(String input) throws OptionsParsingException {
try {
return Long.decode(input);
} catch (NumberFormatException e) {
throw new OptionsParsingException("'" + input + "' is not a long", e);
}View on GitHub (pinned to e6e199d060)
Solutions
- Pass a plain decimal integer within int range, e.g. --jobs=1500.
- Remove separators and unit suffixes from the value.
- If the flag legitimately takes values beyond Integer.MAX_VALUE, check whether a long-typed flag/converter exists for it.
Example fix
# before bazel build --jobs=1,500 //... # after bazel build --jobs=1500 //...
Defensive patterns
Strategy: validation
Validate before calling
boolean isParsableInt(String s) {
if (s == null) return false;
try { Integer.decode(s); return true; }
catch (NumberFormatException e) { return false; }
} Type guard
boolean isIntFlagValue(String s) {
return s != null && s.matches("[+-]?(0x[0-9a-fA-F]+|0[0-7]*|[1-9][0-9]*)");
} Prevention
- Strip thousands separators and unit suffixes before passing int flags.
- Validate numeric env vars once at script startup, not per flag.
- Prefer plain decimal literals; hex/octal decode forms confuse readers.
When it happens
Trigger: Passing --jobs=1.5, --jobs=1,000, --jobs="" (empty), --jobs=10L, or a value outside Integer range such as --jobs=99999999999 to an option using IntegerConverter.
Common situations: Localized number formats (thousands separators, comma decimal); copying Java literals (10L, 0xFF then mistyped as FF); values sized for a long passed to an int option; unset shell variables expanding to empty.
Related errors
- '" + input + "' is not a boolean
- '" + input + "' is not a long
- '" + input + "' is not a double
- Not a valid %s: '%s' (should be auto or a boolean)
- '" + input + "' unexpected
AI-assisted analysis of bazelbuild/bazel@e6e199d060 (2026-08-14).
Data as JSON: /api/errors/de4b6447e7aac78e.
Report an issue: GitHub.