{"record":{"id":"710aba88c708bd57","repo":"prestodb/presto","slug":"kafka-split-error-710aba","errorCode":"KAFKA_SPLIT_ERROR","errorMessage":"Cannot list splits for table '%s' reading topic '%s'","messagePattern":"Cannot list splits for table '(.+?)' reading topic '(.+?)'","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-kafka/src/main/java/com/facebook/presto/kafka/KafkaSplitManager.java","lineNumber":142,"sourceCode":"                        topic,\n                        kafkaTableHandle.getKeyDataFormat(),\n                        kafkaTableHandle.getMessageDataFormat(),\n                        kafkaTableHandle.getKeyDataSchemaLocation().map(KafkaSplitManager::readSchema),\n                        kafkaTableHandle.getMessageDataSchemaLocation().map(KafkaSplitManager::readSchema),\n                        partition.partition(),\n                        beginningOffset,\n                        endOffset,\n                        partitionLeader);\n                splits.add(split);\n            }\n\n            return new FixedSplitSource(splits.build());\n        }\n        catch (Exception e) { // Catch all exceptions because Kafka library is written in scala and checked exceptions are not declared in method signature.\n            if (e instanceof PrestoException) {\n                throw e;\n            }\n            throw new PrestoException(KAFKA_SPLIT_ERROR, format(\"Cannot list splits for table '%s' reading topic '%s'\", kafkaTableHandle.getTableName(), kafkaTableHandle.getTopicName()), e);\n        }\n    }\n\n    private static long findOffsetsByTimestamp(KafkaConsumer<ByteBuffer, ByteBuffer> consumer, TopicPartition topicPartition, long timestamp)\n    {\n        try {\n            Map<TopicPartition, OffsetAndTimestamp> topicPartitionOffsets = consumer.offsetsForTimes(ImmutableMap.of(topicPartition, timestamp));\n            if (topicPartitionOffsets == null || topicPartitionOffsets.values().size() == 0) {\n                return 0;\n            }\n            OffsetAndTimestamp offsetAndTimestamp = topicPartitionOffsets.values().iterator().next();\n            return offsetAndTimestamp.offset();\n        }\n        catch (IllegalArgumentException e) {\n            throw new PrestoException(KAFKA_CONSUMER_ERROR, String.format(\"Failed to find offset by timestamp: %d for partition %d\", timestamp, topicPartition.partition()), e);\n        }\n    }\n","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-kafka/src/main/java/com/facebook/presto/kafka/KafkaSplitManager.java#L124-L160","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check broker connectivity and kafka.nodes configuration from the coordinator/worker","Confirm the topic exists: kafka-topics.sh --list --bootstrap-server <broker>","Increase Kafka client timeouts or investigate broker latency if timeouts are the cause","Inspect the wrapped cause in the Presto exception stack trace — the root Kafka exception identifies the exact problem"],"exampleFix":"// before\nkafka.nodes=localhost:9092\n// after\nkafka.nodes=kafka1.prod:9092,kafka2.prod:9092,kafka3.prod:9092","handlingStrategy":"retry","validationCode":"// preflight from coordinator/worker\nkafka-topics.sh --bootstrap-server <kafka.nodes> --list | grep <topic>","typeGuard":"null","tryCatchPattern":"try { select(); } catch (PrestoException e) {\n  if (e.getErrorCode() == KAFKA_SPLIT_ERROR.toErrorCode()) {\n    log.cause(e.getCause()); // real Kafka client error\n    // fix connectivity/topic, then retry\n  }\n}","preventionTips":["Inspect the wrapped cause — it names the real failure","Keep kafka.nodes a multi-broker list for failover","Verify topic existence before querying","Tune Kafka client timeouts for large clusters"],"tags":["kafka","splits","network","presto-connector"],"backgroundTag":"kafka-broker-unreachable","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}