prestodb/presto · error · PrestoException
GENERIC_INTERNAL_ERROR
GENERIC_INTERNAL_ERROR
Error message
Invalid InetAddress length:
What it means
castToIpAddress converts the parsed InetAddress to a 4- or 16-byte representation and throws GENERIC_INTERNAL_ERROR for any other byte length. Since InetAddresses.forString only ever returns 4 or 16 bytes, this is a defensive assertion indicating an unexpected internal state rather than user data problems.
Source
Thrown at presto-elasticsearch/src/main/java/com/facebook/presto/elasticsearch/decoders/IpAddressDecoder.java:85
try {
address = InetAddresses.forString(slice.toStringUtf8()).getAddress();
}
catch (IllegalArgumentException e) {
throw new PrestoException(INVALID_CAST_ARGUMENT, "Cannot cast value to IPADDRESS: " + slice.toStringUtf8());
}
byte[] bytes;
if (address.length == 4) {
bytes = new byte[16];
bytes[10] = (byte) 0xff;
bytes[11] = (byte) 0xff;
arraycopy(address, 0, bytes, 12, 4);
}
else if (address.length == 16) {
bytes = address;
}
else {
throw new PrestoException(GENERIC_INTERNAL_ERROR, "Invalid InetAddress length: " + address.length);
}
return wrappedBuffer(bytes);
}
}
View on GitHub (pinned to 55bb57d202)
Solutions
- Treat it as a bug: report it with the value being decoded and the Guava/JDK versions in use.
- Check Guava version compatibility; upgrade or downgrade facebook/presto-elasticsearch and Guava to a known-good combination.
- As a workaround, map the field as VARCHAR and cast in SQL to bypass castToIpAddress.
Defensive patterns
Strategy: try-catch
Try / catch
try { runQuery(); } catch (PrestoException e) { if (e.getErrorCode().getCode() == GENERIC_INTERNAL_ERROR) { fileBugWithQueryAndData(); } throw e; } Prevention
- Pin known-good Guava and connector versions; test upgrades in staging.
- Treat this error as a bug report trigger, not user error.
- Avoid patching InetAddresses-based parsing paths in the decoder.
When it happens
Trigger: In practice unreachable: it fires only if castToIpAddress somehow obtains an InetAddress whose getAddress() length is neither 4 nor 16, i.e. a future/alternate InetAddress implementation returning an unexpected size.
Common situations: Essentially never hit by users; would appear only after a Guava/JDK behavior change or patched InetAddresses behavior, or if the decoder were modified to use a different parsing path.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- ELASTICSEARCH_TYPE_MISMATCH
- ELASTICSEARCH_TYPE_MISMATCH
- INVALID_CAST_ARGUMENT
- ELASTICSEARCH_TYPE_MISMATCH
- ELASTICSEARCH_TYPE_MISMATCH
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/2dc9fbcbd404c371.
Report an issue: GitHub.