prestodb/presto · error · IllegalArgumentException
Unable to parse '%s' offset for column '%s'
Error message
Unable to parse '%s' offset for column '%s'
What it means
RawRowEncoder.parseOffset converts the start/end groups of a matched mapping string to integers via parseInt. A NumberFormatException is rethrown as IllegalArgumentException 'Unable to parse <start|end> offset for column <name>', chaining the original exception.
Source
Thrown at presto-kafka/src/main/java/com/facebook/presto/kafka/encoder/raw/RawRowEncoder.java:165
this.end = parseOffset(mappingMatcher.group(2), "end", this.name);
}
else {
this.start = parseOffset(mappingMatcher.group(1), "start", this.name);
this.end = this.start + this.fieldType.getSize();
}
}
else {
throw new IllegalArgumentException(format("No mapping defined for column '%s'", this.name));
}
}
private static int parseOffset(String group, String offsetName, String columnName)
{
try {
return parseInt(group);
}
catch (NumberFormatException e) {
throw new IllegalArgumentException(format("Unable to parse '%s' offset for column '%s'", offsetName, columnName), e);
}
}
private static FieldType parseFieldType(String dataFormat, String columnName)
{
try {
if (!dataFormat.isEmpty()) {
return FieldType.valueOf(dataFormat.toUpperCase(Locale.ENGLISH));
}
return FieldType.BYTE;
}
catch (IllegalArgumentException e) {
throw new IllegalArgumentException(format("Invalid dataFormat '%s' for column '%s'", dataFormat, columnName));
}
}
private static void checkFieldType(String columnName, Type columnType, FieldType fieldType)
{View on GitHub (pinned to 55bb57d202)
Solutions
- Use integer offsets within Integer range for both start and end in the mapping string (e.g. '0-8', not '99999999999-100000000007').
- Ensure offsets are plain decimal digits with no sign or whitespace.
- If the message is genuinely that large, remap the needed bytes at smaller offsets or switch to a structured data format.
Example fix
// before "mapping": "2147483648-2147483655" // after "mapping": "0-7"
Defensive patterns
Strategy: validation
Validate before calling
// ensure offsets are plain integers within range before using them
long off = Long.parseLong(group); // fail fast on bad input
if (off < 0 || off > Integer.MAX_VALUE) {
throw new IllegalArgumentException("Offset out of int range: " + group);
}
Try / catch
try {
createKafkaTable(defn);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("Unable to parse")) {
// fix the named column's start/end offsets to plain decimal ints
}
throw e;
} Prevention
- Use plain decimal offsets without signs, whitespace, or leading '+' characters.
- Keep offsets under 2^31-1; message slices are int-indexed.
- Compute end offsets with a script (start + typeSize) rather than typing large literals by hand.
When it happens
Trigger: A mapping like '01234567890123-5' (offset exceeding Integer.MAX_VALUE) or a mapping that matched the pattern with a group too large/non-numeric, parsed as a start or end offset for the column.
Common situations: Mapping offsets past 2^31-1 in very large messages; leading '+' sign or other characters accepted by the regex but not parseInt; accidental concatenation in templated config producing huge numbers.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Mapping length '%s' is not equal to expected length '%s' for
- Invalid mapping for column '%s'
- No mapping defined for column '%s'
- unexpected internal column '%s'
- Column '%s' does not support 'null' value
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/d6fef64999af808d.
Report an issue: GitHub.