prestodb/presto · error · PrestoException

KAFKA_SPLIT_ERROR

KAFKA_SPLIT_ERROR

Error message

Cannot list splits for table '%s' reading topic '%s'

What it means

This is the catch-all in KafkaSplitManager.getSplits: any exception thrown by the Kafka consumer while listing partitions or computing offsets (that is not already a PrestoException) is wrapped into KAFKA_SPLIT_ERROR naming the table and topic. It signals Presto could not enumerate the topic's splits at all.

Source

Thrown at presto-kafka/src/main/java/com/facebook/presto/kafka/KafkaSplitManager.java:142

                        topic,
                        kafkaTableHandle.getKeyDataFormat(),
                        kafkaTableHandle.getMessageDataFormat(),
                        kafkaTableHandle.getKeyDataSchemaLocation().map(KafkaSplitManager::readSchema),
                        kafkaTableHandle.getMessageDataSchemaLocation().map(KafkaSplitManager::readSchema),
                        partition.partition(),
                        beginningOffset,
                        endOffset,
                        partitionLeader);
                splits.add(split);
            }

            return new FixedSplitSource(splits.build());
        }
        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 list splits for table '%s' reading topic '%s'", kafkaTableHandle.getTableName(), kafkaTableHandle.getTopicName()), e);
        }
    }

    private static long findOffsetsByTimestamp(KafkaConsumer<ByteBuffer, ByteBuffer> consumer, TopicPartition topicPartition, long timestamp)
    {
        try {
            Map<TopicPartition, OffsetAndTimestamp> topicPartitionOffsets = consumer.offsetsForTimes(ImmutableMap.of(topicPartition, timestamp));
            if (topicPartitionOffsets == null || topicPartitionOffsets.values().size() == 0) {
                return 0;
            }
            OffsetAndTimestamp offsetAndTimestamp = topicPartitionOffsets.values().iterator().next();
            return offsetAndTimestamp.offset();
        }
        catch (IllegalArgumentException e) {
            throw new PrestoException(KAFKA_CONSUMER_ERROR, String.format("Failed to find offset by timestamp: %d for partition %d", timestamp, topicPartition.partition()), e);
        }
    }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Check broker connectivity and kafka.nodes configuration from the coordinator/worker
  2. Confirm the topic exists: kafka-topics.sh --list --bootstrap-server <broker>
  3. Increase Kafka client timeouts or investigate broker latency if timeouts are the cause
  4. Inspect the wrapped cause in the Presto exception stack trace — the root Kafka exception identifies the exact problem

Example fix

// before
kafka.nodes=localhost:9092
// after
kafka.nodes=kafka1.prod:9092,kafka2.prod:9092,kafka3.prod:9092
Defensive patterns

Strategy: retry

Validate before calling

// preflight from coordinator/worker
kafka-topics.sh --bootstrap-server <kafka.nodes> --list | grep <topic>

Type guard

null

Try / catch

try { select(); } catch (PrestoException e) {
  if (e.getErrorCode() == KAFKA_SPLIT_ERROR.toErrorCode()) {
    log.cause(e.getCause()); // real Kafka client error
    // fix connectivity/topic, then retry
  }
}

Prevention

When it happens

Trigger: getSplits executes and consumer.partitionsFor, consumer.assign, beginningOffsets/endOffsets, or findOffsetsByTimestamp throws — e.g. timeout talking to the cluster, unknown topic, or an unexpected IllegalArgumentException from the Kafka client.

Common situations: kafka.nodes points to a dead cluster; topic deleted between metadata parse and query; Kafka client timeouts under load (default request.timeout exceeded); SASL/SSL handshake failure from workers.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/710aba88c708bd57. Report an issue: GitHub.