apache/flink · error · IllegalArgumentException
The value '${number}' cannot be represented as an integer nu
Error message
The value '${number}' cannot be represented as an integer number. What it means
After parseDuration extracts a leading digit run, it converts that substring with new BigInteger. Overflow is impossible (BigInteger), so this IllegalArgumentException means the digit run itself was not a valid integer token — classically a bare decimal point, a lone sign, or a floating-point value like ".5" or "1.5".
Source
Thrown at flink-core/src/main/java/org/apache/flink/util/TimeUtils.java:101
// Fall back to parse ISO-8601 duration format
Duration parsedDuration = Duration.parse(trimmed);
if (parsedDuration.isNegative()) {
// Don't support negative duration which is consistent with before format
throw new NumberFormatException("negative duration is not supported");
}
return parsedDuration;
} catch (DateTimeParseException e) {
throw new NumberFormatException(
"text does not start with a number, and is not a valid ISO-8601 duration format: "
+ trimmed);
}
}
final BigInteger value;
try {
value = new BigInteger(number); // this throws a NumberFormatException
} catch (NumberFormatException e) {
throw new IllegalArgumentException(
"The value '" + number + "' cannot be represented as an integer number.", e);
}
final ChronoUnit unit;
if (unitLabel.isEmpty()) {
unit = ChronoUnit.MILLIS;
} else {
unit = LABEL_TO_UNIT_MAP.get(unitLabel);
}
if (unit == null) {
throw new IllegalArgumentException(
"Time interval unit label '"
+ unitLabel
+ "' does not match any of the recognized units: "
+ TimeUnit.getAllUnits());
}
try {View on GitHub (pinned to 2f3c205e92)
Solutions
- Use an integer value with a smaller unit: "90 s" instead of "1.5 min".
- Or use ISO-8601 which permits fractional seconds: "PT1.5M".
- If generating config programmatically, round or convert durations to integral units before serialization.
Example fix
# before timeout=1.5 min # after timeout=90 s
Defensive patterns
Strategy: validation
Validate before calling
if (t.matches(".*\\d\\.\\d.*") && !t.startsWith("P")) {
// fractional in number+unit form: convert to integral smaller unit or PT form first
t = toIso8601(t); // custom conversion
}
TimeUtils.parseDuration(t); Prevention
- Avoid fractional values in number+unit durations; express in a smaller unit.
- Use ISO-8601 (PT1.5M) when fractions are required.
- Round durations to whole units in config generators.
When it happens
Trigger: Calling TimeUtils.parseDuration("1.5 s") or TimeUtils.parseDuration(".5min"): the digit scan stops at '.', leaving number="1" or ".5"-style tokens that BigInteger cannot parse depending on where the scan stopped; typically triggered by decimal values.
Common situations: Users writing fractional durations ("1.5 min") — supported by ISO-8601 but not by the number+unit path when the integer part is malformed; config generators emitting doubles into duration fields.
Related errors
- negative duration is not supported
- text does not start with a number, and is not a valid ISO-86
- Time interval unit label '${unitLabel}' does not match any o
- The value '${number}' cannot be represented as Duration (num
- Could not configure serializers from %s.
AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14).
Data as JSON: /api/errors/92b754662b6185a8.
Report an issue: GitHub.