Kafka consumer fetching topic metadata for topics from broker [ArrayBuffer(id0,hostuser-Desktop,port9092)] failed
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
This error means the consumer failed during metadata lookup, before normal message polling even began. The usual causes are broker reachability problems, bad advertised.listeners, security mismatches, or missing topic access, so the fastest path is to test connectivity from the consumer’s real runtime environment.
What Metadata Lookup Does
Before a consumer can read records, it asks the cluster for metadata such as:
- which partitions exist for the topic
- which broker leads each partition
- which broker addresses the client should use next
If that request fails, the consumer never reaches the normal poll() loop. That is why this error appears even though no business-level message processing has started.
This is important because it tells you where to look: client-to-cluster connectivity and cluster identity, not downstream consumer logic.
First Test the Bootstrap Address
From the same host, container, or pod where the consumer actually runs, try:
If those commands fail from that environment, the problem is almost certainly one of:
- DNS resolution
- port reachability
- broker availability
- wrong bootstrap address
Do not only test from your laptop if the real consumer runs somewhere else. Metadata failures are often environment-specific.
advertised.listeners Is a Frequent Root Cause
One of the most common Kafka networking problems is that the broker listens on one address but advertises another address that the client cannot use.
Example:
This might work for a local client on the same machine, but fail for a client in Docker, Kubernetes, or another host where user-Desktop is not resolvable or routable.
That leads to a classic pattern:
- bootstrap connection works
- broker returns metadata
- client tries the advertised broker address
- metadata fetch or follow-up communication fails
So if the bootstrap server looks partly reachable but the consumer still fails, inspect advertised.listeners early.
Security Mismatch Can Fail Metadata Too
Metadata requests are normal Kafka protocol traffic. If the cluster expects TLS or SASL and the client uses plaintext defaults, the failure can surface during metadata fetch.
Example consumer configuration:
If the broker expects secure communication and the client does not match, the consumer may fail before it ever sees a record.
So a metadata error does not necessarily mean “the broker is down.” It can also mean “the protocol handshake is wrong.”
Verify Topic Existence and Permissions
Do not assume the topic is present and accessible just because the broker is reachable.
Check the topic explicitly:
In secured clusters, ACLs also matter. A client may need permission to describe and read the topic, and missing permissions can surface during metadata-related operations.
A practical checklist is:
- broker reachable
- advertised broker addresses reachable
- topic exists
- security settings match
- ACLs allow access
Troubleshoot in a Fixed Order
A useful order is:
- confirm the broker process and port are reachable
- confirm topic existence
- inspect
advertised.listeners - confirm client security settings
- confirm permissions and ACLs
This avoids changing several layers at once and losing track of the real cause.
If you edit broker networking, client security, and ACLs all at the same time, it becomes much harder to isolate which change actually solved the problem.
Common Pitfalls
The biggest mistake is testing from the wrong environment. A consumer inside a pod or container can fail even when the broker is reachable from your workstation.
Another issue is focusing only on the bootstrap address and ignoring the broker addresses returned through metadata. That is exactly where advertised.listeners breaks clients.
People also often assume metadata failures must mean broker crashes. In reality, protocol mismatch and access control can fail the same phase.
Finally, troubleshooting becomes much slower when multiple variables are changed at once. Work layer by layer.
Summary
- This error means the consumer failed during metadata lookup, before normal polling started.
- Test connectivity from the consumer’s actual runtime environment.
- Check
advertised.listeners, because it is a very common cause of metadata failures. - Confirm topic existence, security settings, and permissions.
- Troubleshoot in a fixed order so the real cause is isolated cleanly.

