kafka configuration_error ai_generated true

org.apache.kafka.common.errors.TimeoutException: Topic my_topic not present in metadata after 60000 ms

ID: kafka/topic-not-in-metadata

Also available as: JSON · Markdown
88%Fix Rate
90%Confidence
3Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3 active

Root Cause

Producer/consumer cannot find topic. Topic does not exist and auto-creation is disabled, or bootstrap servers are wrong.

generic

Workarounds

  1. 92% success Create the topic explicitly before producing/consuming
    kafka-topics.sh --create --topic my_topic --bootstrap-server localhost:9092 --partitions 3 --replication-factor 1

    Sources: https://kafka.apache.org/documentation/

  2. 90% success Verify bootstrap servers are correct and reachable
    kafka-broker-api-versions.sh --bootstrap-server localhost:9092
  3. 85% success Check topic exists with list command
    kafka-topics.sh --list --bootstrap-server localhost:9092

Dead Ends

Common approaches that don't work:

  1. Set auto.create.topics.enable=true in production 72% fail

    Auto-creation leads to typo-induced phantom topics. Create topics explicitly in production.

  2. Connect directly to a broker instead of using bootstrap servers 80% fail

    Direct broker connection bypasses cluster metadata; breaks when broker changes or cluster rebalances