conduktor.io ↗

Kafka Exception FencedLeaderEpochException

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

The request contained a leader epoch which is smaller than that on the broker that received the request. This can happen when an operation is attempted before a pending metadata update has been received. Clients will typically refresh metadata before retrying.

Common Causes

Solutions

Example Stack Trace

org.apache.kafka.common.errors.FencedLeaderEpochException: The leader epoch in the request is older than the epoch on the broker.

Diagnostic Commands

# Look for epoch fencing events in logs grep 'FencedLeaderEpoch\|leader.epoch\|LeaderAndIsr' /path/to/kafka/logs/controller.log | tail -30 # Describe topic replicas and ISR status kafka-topics.sh --bootstrap-server localhost:9092 --describe --topic <topic> | grep -E 'Leader|Isr|Replicas'

Related

Protocol error: FENCED_LEADER_EPOCH (code 74)

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

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