prestodb/presto · error · PrestoException
GENERIC_INTERNAL_ERROR
GENERIC_INTERNAL_ERROR
Error message
Failed to parse document source
What it means
getNextPage wraps IOException from Jackson deserialization of an Elasticsearch hit's _source JSON into this PrestoException: a document in the index does not match the expected JSON structure and cannot be converted to the table schema.
Source
Thrown at presto-elasticsearch/src/main/java/com/facebook/presto/elasticsearch/ScanQueryPageSource.java:211
public void close()
{
iterator.close();
}
@Override
public Page getNextPage()
{
long size = 0;
while (size < PageBuilderStatus.DEFAULT_MAX_PAGE_SIZE_IN_BYTES && iterator.hasNext()) {
Hit hit = iterator.next();
Map<String, Object> document;
try {
JsonData source = (JsonData) hit.source();
document = mapper.readValue(source.toJson().toString(), new TypeReference<>() {});
}
catch (IOException e) {
throw new PrestoException(GENERIC_INTERNAL_ERROR, "Failed to parse document source");
}
for (int i = 0; i < decoders.size(); i++) {
String field = columns.get(i).getName();
decoders.get(i).decode(hit, () -> getField(document, field), columnBuilders[i]);
}
if (hit.source() != null) {
try {
String json = mapper.writeValueAsString(hit.source());
totalBytes += json.getBytes(StandardCharsets.UTF_8).length;
}
catch (JsonProcessingException e) {
throw new PrestoException(GENERIC_INTERNAL_ERROR, "Failed to serialize document source");
}
}
completedPositions += 1;View on GitHub (pinned to 55bb57d202)
Solutions
- Check that the index mapping and stored _source are valid JSON
- Reindex documents with malformed sources
- Verify field types in the index mapping match expectations
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at presto-elasticsearch/src/main/java/com/facebook/presto/elasticsearch/ScanQueryPageSource.java:211 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/038937d0623821bf.
Report an issue: GitHub.