apache/flink · error · NumberFormatException
Value overflow/underflow
Error message
Value overflow/underflow
What it means
Thrown by IntParser.parseField when the accumulated value exceeds the int range. Digits are accumulated in a long and checked against OVERFLOW_BOUND/UNDERFLOW_BOUND each step, so any field whose numeric value falls outside [-2147483648, 2147483647] is rejected early with NumberFormatException.
Source
Thrown at flink-core/src/main/java/org/apache/flink/types/parser/IntParser.java:152
startPos++;
length--;
if (length == 0 || bytes[startPos] == delimiter) {
throw new NumberFormatException("Orphaned minus sign.");
}
}
for (; length > 0; startPos++, length--) {
if (bytes[startPos] == delimiter) {
return (int) (neg ? -val : val);
}
if (bytes[startPos] < 48 || bytes[startPos] > 57) {
throw new NumberFormatException("Invalid character.");
}
val *= 10;
val += bytes[startPos] - 48;
if (val > OVERFLOW_BOUND && (!neg || val > UNDERFLOW_BOUND)) {
throw new NumberFormatException("Value overflow/underflow");
}
}
return (int) (neg ? -val : val);
}
}
View on GitHub (pinned to 2f3c205e92)
Solutions
- Switch the target type to long: use LongParser.parseField and a BIGINT/long schema for the column.
- If IDs must stay int-width, remap/hash them at the producer to fit the range.
- Fix upstream data if out-of-range values in an int column are producer bugs.
Example fix
// before int v = IntParser.parseField(bytes, start, len, '|'); // fails on "3000000000" // after long v = LongParser.parseField(bytes, start, len, '|'); // widen to long
Defensive patterns
Strategy: validation
Validate before calling
String raw = new String(bytes, start, len, StandardCharsets.UTF_8);
long candidate = Long.parseLong(raw);
if (candidate < Integer.MIN_VALUE || candidate > Integer.MAX_VALUE) {
throw new IllegalArgumentException("Value out of int range: " + candidate);
} Try / catch
try {
int v = IntParser.parseField(bytes, start, len, delim);
} catch (NumberFormatException e) {
if (e.getMessage().equals("Value overflow/underflow")) {
long wider = LongParser.parseField(bytes, start, len, delim); // widen instead
} else throw e;
} Prevention
- Declare growing ID columns as BIGINT/long, not INT.
- Range-check before narrowing parsed integers.
- Monitor source value ranges when schemas evolve.
When it happens
Trigger: Calling IntParser.parseField with fields like "3000000000" or "-3000000000" — integers too large for a Java int.
Common situations: IDs (user/product/transaction IDs) growing beyond 2^31-1 and still declared INT; column type mismatch where a BIGINT source feeds an int field; year 2038-style timestamp values in seconds.
Related errors
- Value overflow/underflow
- Empty field.
- Orphaned minus sign.
- Invalid character.
- Invalid input: Empty string
AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14).
Data as JSON: /api/errors/15b502421e4bd58e.
Report an issue: GitHub.