prestodb/presto · error · PrestoException
KAFKA_SPLIT_ERROR
KAFKA_SPLIT_ERROR
Error message
Cannot read data from topic '%s', partition '%s', startOffset %s, endOffset %s, leader %s
What it means
openFetchRequest wraps any exception from the Kafka consumer's fetch/send call (other than PrestoException) into KAFKA_SPLIT_ERROR, reporting the topic, partition, offset range and leader. This means Presto could not read data from the Kafka broker for this split — connectivity, broker availability, offset-range, or serialization issues inside the raw consumer API.
Source
Thrown at presto-kafka/src/main/java/com/facebook/presto/kafka/KafkaRecordSet.java:328
if (messageAndOffsetIterator == null) {
String threadName = Thread.currentThread().getName();
if (consumer == null) {
consumer = consumerManager.createConsumer(threadName, split.getLeader());
}
TopicPartition topicPartition = new TopicPartition(split.getTopicName(), split.getPartitionId());
consumer.assign(ImmutableList.of(topicPartition));
consumer.seek(topicPartition, cursorOffset);
ConsumerRecords<ByteBuffer, ByteBuffer> records = consumer.poll(POLL_TIMEOUT);
messageAndOffsetIterator = records.records(topicPartition).iterator();
}
}
catch (Exception e) { // Catch all exceptions because Kafka library is written in scala and checked exceptions are not declared in method signature.
if (e instanceof PrestoException) {
throw e;
}
throw new PrestoException(
KAFKA_SPLIT_ERROR,
format(
"Cannot read data from topic '%s', partition '%s', startOffset %s, endOffset %s, leader %s ",
split.getTopicName(),
split.getPartitionId(),
split.getStart(),
split.getEnd(),
split.getLeader()),
e);
}
}
}
}
View on GitHub (pinned to 55bb57d202)
Solutions
- Verify brokers are reachable from Presto worker nodes (telnet broker:9092) and kafka.nodes config is correct
- Check the topic/partition still exists and offsets are within the retained log (kafka-run-class kafka.tools.GetOffsetShell)
- Fix advertised.listeners on the brokers so returned host:port are resolvable by workers
- Retry the query if it was a transient leader election
Example fix
// before kafka.nodes=internal-broker:9092 // after - resolvable from workers, multiple nodes kafka.nodes=broker1.internal:9092,broker2.internal:9092
Defensive patterns
Strategy: retry
Validate before calling
// preflight: check topic reachability from worker kafka-topics.sh --bootstrap-server broker:9092 --describe --topic <topic>
Type guard
null
Try / catch
try { readSplit(); } catch (PrestoException e) {
if (e.getErrorCode() == KAFKA_SPLIT_ERROR.toErrorCode()) {
// verify broker connectivity and offset range, then retry query
}
} Prevention
- Ensure kafka.nodes are resolvable from ALL workers
- Fix broker advertised.listeners to worker-reachable host:port
- Keep query offsets within log retention window
- Monitor broker availability before scheduling heavy scans
When it happens
Trigger: KafkaRecordSet.advanceNextPosition -> openFetchRequest calls consumer.send/poll on a KafkaConsumer; the Kafka scala client throws (broker unreachable, unknown topic/partition, offset out of range, leader changed mid-scan).
Common situations: Broker down or firewall blocking broker port from workers; topic deleted/renamed between split generation and read; advertised.listeners misconfiguration so workers resolve broker hostnames they cannot reach; endOffset beyond log retention (records deleted).
Related errors
- GENERIC_INTERNAL_ERROR
- KAFKA_SPLIT_ERROR
- unexpected internal column '%s'
- KAFKA_SCHEMA_ERROR
- Invalid Kafka Offset start/end pair: %s - %s
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/ac3be5c818f020d7.
Report an issue: GitHub.