# org.apache.kafka.common.errors.LeaderEpochStaleException: The leader epoch in the request is older than the current leader epoch

- **ID:** `kafka/leader-epoch-stale`
- **Domain:** kafka
- **Category:** protocol_error
- **Verification:** ai_generated
- **Fix Rate:** 78%

## Root Cause

A follower or client sent a request with a stale leader epoch, indicating it has not yet learned about a recent leader election, causing the broker to reject the request.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Kafka 2.8.0 | active | — | — |
| Kafka 3.0.0 | active | — | — |
| Kafka 3.4.0 | active | — | — |
| Kafka 3.6.0 | active | — | — |

## Workarounds

1. **Ensure followers can quickly learn about leader changes by reducing the metadata.max.age.ms on the broker:

metadata.max.age.ms=5000  # 5 seconds

Also check that network connectivity between followers and the controller is stable; monitor controller election logs.** (80% success)
   ```
   Ensure followers can quickly learn about leader changes by reducing the metadata.max.age.ms on the broker:

metadata.max.age.ms=5000  # 5 seconds

Also check that network connectivity between followers and the controller is stable; monitor controller election logs.
   ```
2. **If the issue is persistent, manually trigger a preferred leader election to stabilize the leader epoch:

kafka-leader-election --bootstrap-server localhost:9092 --election-type preferred --partition 0 --topic my_topic

This forces all replicas to acknowledge the current leader.** (75% success)
   ```
   If the issue is persistent, manually trigger a preferred leader election to stabilize the leader epoch:

kafka-leader-election --bootstrap-server localhost:9092 --election-type preferred --partition 0 --topic my_topic

This forces all replicas to acknowledge the current leader.
   ```

## Dead Ends

- **Restart the follower broker that sent the stale request** — Restarting may reset the follower's state, but the underlying replication lag or network issue causing the stale epoch will persist. (75% fail)
- **Increase the replica.fetch.wait.max.ms on the follower** — This setting controls how long a follower waits for fetch responses, but does not update the leader epoch; the follower needs to actively learn the new epoch via metadata requests. (85% fail)
