Kafka Exception NotCoordinatorException
org.apache.kafka.common.errors.NotCoordinatorException
Retriable
Consumer
In the context of the group coordinator, the broker returns this error code if it receives an offset fetch or commit request for a group it's not the coordinator of. In the context of the transactional coordinator, it returns this error when it receives a transactional request with a transactionalId the coordinator doesn't own.
Common Causes
- Consumer group coordinator migrated to another broker after a broker restart or partition reassignment of __consumer_offsets
- Client cached the old coordinator address and is still sending group management requests to a broker that no longer owns the partition
- Rolling restart of brokers causing coordinator to move; clients using the old coordinator get NOT_COORDINATOR until metadata refresh
Solutions
- This is retriable: the client will call FindCoordinator again and route to the correct broker; ensure 'retry.backoff.ms' allows time for metadata refresh (100-500ms)
- Verify the client library version handles NOT_COORDINATOR with a FindCoordinator retry — older client versions may not handle this correctly; upgrade to latest
- If persistent, check __consumer_offsets partition leaders: kafka-topics.sh --describe --topic __consumer_offsets; all partitions should have a valid leader
Example Stack Trace
org.apache.kafka.common.errors.NotCoordinatorException: This is not the correct coordinator.Diagnostic Commands
# Check for leaderless __consumer_offsets partitions
kafka-topics.sh --describe --topic __consumer_offsets --bootstrap-server localhost:9092 | grep 'Leader: none'
# Look for related errors in broker logs
grep -E 'NotCoordinator|FindCoordinator|Coordinator for group' /var/log/kafka/server.log | tail -20Related
Protocol error: NOT_COORDINATOR (code 16)
Related Consumer exceptions: CommitFailedException · CoordinatorLoadInProgressException · CoordinatorNotAvailableException · FencedInstanceIdException · FencedMemberEpochException · GroupMaxSizeReachedException · IllegalGenerationException · InvalidGroupIdException
Hitting
NotCoordinatorException in production? Conduktor Console gives you real-time visibility into clients, consumer groups, and broker health. Browse every Kafka exception or protocol error code.