<@U04S8PLJWMT>, we are subscribing to a kafka topi...
# ask-ai
n
@kapa.ai, we are subscribing to a kafka topic which has data to consume, however Airbyte is showing NO records to pull, and the LAG is increasing in the Kafka topic
k
If Airbyte is showing no records to pull from a Kafka topic that definitely has data (and the Kafka consumer lag is increasing), this is a known issue that has been reported by multiple users. Here are some key points and troubleshooting steps based on the knowledge sources: 1. Partition Assignment Delay: One common cause is that the Kafka consumer in Airbyte may not be waiting for partition assignment before starting to poll for messages. If the consumer starts polling before partitions are assigned, it may not read any records. A workaround is to ensure the consumer waits for partition assignment before polling. In custom Java code, this is done by adding a loop like:
Copy code
java    while (consumer.assignment().isEmpty()) {        consumer.poll(Duration.ofMillis(100)); // Short poll to trigger partition assignment        System.out.println("Waiting for partition assignment...");    }
This ensures the consumer is properly assigned to partitions before attempting to read messages. However, this fix is not yet part of the official Airbyte Kafka source connector, so you may need to monitor for updates or consider building a custom connector if you are able to do so [🐛 Source Kafka: no records are read](https://github.com/airbytehq/airbyte/issues/8875). 2. Kafka Source Connector Format Requirements: The Kafka source connector may require a specific JSON format. If the messages in your topic do not match the expected format, Airbyte may not be able to parse them, resulting in empty records being read. Double-check that your Kafka messages are in the correct format (e.g., plain JSON or Avro, as configured in Airbyte) [Kafka Source Setup Guide](https://docs.airbyte.com/integrations/sources/kafka). 3. Consumer Group and Permissions: Ensure that the Airbyte consumer has the correct group ID and sufficient permissions to read from the topic. If the consumer cannot join the group or lacks permissions, it may not be able to consume messages [Kafka - Total records read: 0 (0 bytes)](https://discuss.airbyte.io/t/901). 4. Kafka Version Compatibility: Airbyte requires Kafka cluster version 1.0 or above. Using older versions or incompatible protocol settings may cause issues with message consumption [Kafka Source Setup Guide](https://docs.airbyte.com/integrations/sources/kafka). 5. Check for Known Bugs: There are open issues where users report that Airbyte reads zero records even though data exists in the topic. In some cases, the Airbyte message is created with data, but the destination receives an empty record. This suggests a possible bug in the connector's handling of message data [🐛 Source Kafka: no records are read](https://github.com/airbytehq/airbyte/issues/8875). Summary of Actions: - Ensure your Kafka messages are in the expected format. - Confirm Airbyte's consumer group has the right permissions. - Make sure your Kafka version is supported. - If possible, monitor the Airbyte logs for partition assignment and consumer activity. - Watch for updates or fixes to the Kafka source connector, as this is a known issue. If after these checks the issue persists, you may be encountering the same bug as other users, and it may require a fix from the Airbyte team or a custom patch as described above. You can follow or contribute to the ongoing discussion in the related GitHub issue for updates and potential workarounds [🐛 Source Kafka: no records are read](https://github.com/airbytehq/airbyte/issues/8875).