Kafka Error NOT_ENOUGH_REPLICAS
Error code 19 · Retriable Broker
Messages are rejected since there are fewer in-sync replicas than required.
Common Causes
- One or more brokers are down, shrinking the ISR below 'min.insync.replicas' (common during broker maintenance or unplanned failures)
- Slow replica brokers falling out of ISR due to disk I/O bottleneck causing replica fetch lag to exceed 'replica.lag.time.max.ms'
- Cluster scaled down (broker decommissioned) without first reassigning partitions, leaving some partitions under-replicated
Solutions
- Short-term: temporarily reduce 'min.insync.replicas' on the affected topic to allow writes to proceed during the incident (acknowledge this reduces durability guarantees)
- Restore the downed broker or add a replacement broker and use kafka-reassign-partitions.sh to rebalance partitions back to full replication
- Monitor ISR size proactively: alert when 'UnderReplicatedPartitions' JMX metric > 0 for more than 60 seconds to catch degradation before min.insync.replicas is breached
Diagnostic Commands
# Check for under-replicated partitions
kafka-topics.sh --describe --bootstrap-server localhost:9092 --under-replicated-partitions
# Check for unavailable partitions
kafka-topics.sh --describe --bootstrap-server localhost:9092 --unavailable-partitionsRelated APIs
This error can be returned by: EndTxn · InitProducerId · Produce · WriteTxnMarkers
Debugging Kafka errors? Conduktor Console gives you real-time visibility into your cluster. Explore all errors in the Error Decoder.