Kafka Error ELECTION_NOT_NEEDED
Error code 84 · Retriable Broker
Leader election not needed for topic partition.
Common Causes
- An explicit preferred leader election was triggered via kafka-leader-election.sh or the Admin API, but the partition already has its preferred leader as the current leader
- Automated tooling (e.g., cruise control, custom scripts) triggered a batch election that included already-optimal partitions
- Race condition where another process completed the election between the check and the request
Solutions
- This is informational/benign — no action needed. The partition is already in the desired state. Treat this response code as a success in automation scripts
- Filter out ELECTION_NOT_NEEDED responses in tooling and only alert on genuine failures; do not retry
- When scripting elections, first check current leader vs preferred replica with kafka-topics.sh --describe and only elect for partitions where they diverge
Diagnostic Commands
# Show partition leader vs preferred replica
kafka-topics.sh --bootstrap-server localhost:9092 --describe --topic <topic> | grep -E 'Leader:|Replicas:'
# Check for unavailable partitions
kafka-topics.sh --bootstrap-server localhost:9092 --describe --unavailable-partitionsRelated APIs
This error can be returned by: ElectLeaders
Debugging Kafka errors? Conduktor Console gives you real-time visibility into your cluster. Explore all errors in the Error Decoder.