Kafka consumer doesn't consume messages from an existing topic
Codemia Knowledge Hub ·
When a Kafka consumer reads nothing from a topic that exists, the cause is usually configuration: the wrong consumer group, a mistyped topic name, offsets that are out of range, an improper auto.offset.reset, or misconfigured deserializers. Network problems and broker permissions are the other common causes. Check them in the order below.
Why consumers fail to consume
1. Consumer group misconfiguration
The consumer may be in the wrong consumer group or in no group at all. Kafka consumers use a group to coordinate and distribute partitions, so consumers that unintentionally end up in different groups do not share the work of reading a topic.
2. The topic or partition does not exist
A misconfiguration or a typo in the topic name can point the consumer at a topic or partition that does not exist. The consumer then waits indefinitely for messages.
3. Offsets out of range
The consumer's offsets may be out of range when:
- the offsets were altered manually, or
- messages were deleted by Kafka's retention policy, so the consumer asks for an offset that no longer exists.
4. Network problems
Network problems between the broker and the consumer, such as DNS resolution issues, firewall rules or network partitions, can stop messages from arriving.
5. Broker settings
If the broker configuration denies the consumer the permissions it needs, or uses incompatible settings, the consumer may be unable to read the topic.
6. Consumer configuration
An improperly set auto.offset.reset or misconfigured message deserializers can also keep the consumer from consuming messages properly.
Troubleshooting steps
- Validate the topic: make sure the topic exists and the consumer uses the correct topic name.
- Check the consumer group: verify that all intended consumers are in the same consumer group.
- Read consumer and broker logs: they show misconfigurations, errors and network issues.
- Inspect the consumer configuration: double-check
bootstrap.servers,group.id,auto.offset.resetand the deserializer settings. - Run network diagnostics: check connectivity between the consumer and the brokers.
- Check partition assignment: confirm the consumer is assigned partitions. If automatic partition assignment (
partition.assignment.strategy) is misconfigured, a consumer might not receive messages.
Consumer metrics to monitor
These metrics help you spot problems early:
- Consumer lag: the offset difference between the last produced message and the last consumed message.
- Fetch rate: how fast the consumer fetches records.
- Throughput: the number of messages processed in a given timeframe.
Checks at a glance
| Issue | Key Check | Solution Suggestion |
| Misconfigured Group | group.id in consumer config | Ensure all related consumers share the same group.id |
| Non-existent Topic/Partition | Verify topic and partition existence | Correct any typos or misconfigurations in topic names |
| Offset Out of Range | Consumer offset status | Reset the consumer offset to earliest or latest |
| Network Issues | Network connectivity diagnostics | Check firewalls, DNS, and other network settings |
| Broker Settings | Broker permissions and configurations | Adjust configurations or permissions as necessary |
| Incorrect Configuration | auto.offset.reset, Deserializers | Review and correct consumer configuration settings |
Related reading
- Kafka consumer doesn't receive messages until restarted
- Kafka Consumer Error
- Kafka Consumer Error - xxxx nodename nor servname provided, or not known
- Kafka consumer error Cancelled in-flight API_VERSIONS request with correlation id 1 due to node -1 being disconnected
- Kafka consumer Error ERROR Unknown error when running consumer (kafka.tools.ConsoleConsumer)
- Kafka Consumer error Marking coordinator dead
- Kafka consumer exception and offset commits
- Kafka consumer failed to find leader when fetching topic metadata
System design interview problems on this topic
- Design a Distributed Messaging System: solution and walkthrough
- Design a Log Collection and Analysis System: solution and walkthrough
- Design an Ad Click Aggregation System: solution and walkthrough
- Design a Webhook Notification Service: solution and walkthrough

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseSystem Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.