conduktor.io ↗

Kafka Exception LeaderNotAvailableException

org.apache.kafka.common.errors.LeaderNotAvailableException
Retriable Broker

There is no currently available leader for the given partition (either because a leadership election is in progress or because all replicas are down).

Common Causes

Solutions

Example Stack Trace

org.apache.kafka.common.errors.LeaderNotAvailableException: There is no leader for this topic-partition as we are in the middle of a leadership election.

Diagnostic Commands

# Check for partitions without a leader kafka-topics.sh --describe --topic <topic> --bootstrap-server localhost:9092 | grep 'Leader: none' # Check for under-replicated partitions kafka-topics.sh --describe --bootstrap-server localhost:9092 --under-replicated-partitions

Related

Protocol error: LEADER_NOT_AVAILABLE (code 5)

Related Broker exceptions: CorruptRecordException · FencedLeaderEpochException · NetworkException · NotEnoughReplicasAfterAppendException · NotEnoughReplicasException · NotLeaderOrFollowerException · TimeoutException · UnknownLeaderEpochException

Hitting LeaderNotAvailableException in production? Conduktor Console gives you real-time visibility into clients, consumer groups, and broker health. Browse every Kafka exception or protocol error code.