t8y2/dbx · error · IllegalArgumentException
" + name + " is outside the supported integer range
Error message
" + name + " is outside the supported integer range
What it means
nonNegativeExactInt converts a validated non-negative long into an int for the Kafka partition number; values above Integer.MAX_VALUE cannot fit and throw IllegalArgumentException "<name> is outside the supported integer range" (KafkaAgent.java:1541).
Source
Thrown at agents/drivers/kafka/src/main/java/com/dbx/agent/kafka/KafkaAgent.java:1541
for (JsonElement element : offsetArray) {
if (!element.isJsonObject()) {
throw new IllegalArgumentException("each offset must be an object");
}
JsonObject value = element.getAsJsonObject();
int partition = nonNegativeExactInt(value, "partition");
long offset = nonNegativeExactLong(value, "offset");
TopicPartition topicPartition = new TopicPartition(topic, partition);
if (offsets.put(topicPartition, new OffsetAndMetadata(offset)) != null) {
throw new IllegalArgumentException("duplicate partition in offsets: " + partition);
}
}
return offsets;
}
private static int nonNegativeExactInt(JsonObject object, String name) {
long value = nonNegativeExactLong(object, name);
if (value > Integer.MAX_VALUE) {
throw new IllegalArgumentException(name + " is outside the supported integer range");
}
return (int) value;
}
private static long nonNegativeExactLong(JsonObject object, String name) {
JsonElement element = object.get(name);
if (element == null || !element.isJsonPrimitive() || !element.getAsJsonPrimitive().isNumber()) {
throw new IllegalArgumentException(name + " must be a non-negative integer");
}
try {
java.math.BigDecimal decimal = element.getAsBigDecimal();
if (decimal.signum() < 0 || decimal.stripTrailingZeros().scale() > 0) {
throw new IllegalArgumentException(name + " must be a non-negative integer");
}
return decimal.longValueExact();
} catch (ArithmeticException error) {
throw new IllegalArgumentException(name + " is outside the supported integer range", error);
}View on GitHub (pinned to c0390bff16)
Solutions
- Ensure the partition value fits in a 32-bit int (0..2147483647)
- Swap the values if partition and offset were transposed
- Clamp or reject out-of-range values client-side before the call
Example fix
// before
{"partition": 5000000000, "offset": 100}
// after
{"partition": 0, "offset": 100} Defensive patterns
Strategy: validation
Validate before calling
if (!Number.isInteger(partition) || partition < 0 || partition > 2147483647) throw new Error('invalid partition'); Type guard
function isValidPartition(p) { return Number.isInteger(p) && p >= 0 && p <= 2147483647; } Try / catch
try { agent.execute(req); } catch (e) { if (String(e.message).includes('outside the supported integer range')) { /* check partition/offset values */ } else throw e; } Prevention
- Keep partition values within int range
- Verify field order — partition and offset are easy to swap
- Range-check values derived from hashes or other long sources
When it happens
Trigger: Supplying a "partition" (or any field routed through nonNegativeExactInt) larger than 2147483647, e.g. passing a 64-bit offset value into the partition field.
Common situations: Swapping partition/offset values in the payload; computing partition from a hash stored as long; copying an offset value into the partition slot.
Related errors
- offsets must contain at least one partition offset
- each offset must be an object
- duplicate partition in offsets: " + partition
- " + name + " must be a non-negative integer
- timestampMs is required when position is timestamp
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/77428b06bd59389b.
Report an issue: GitHub.