Kafka Error NOT_ENOUGH_REPLICAS_AFTER_APPEND
Error code 20 · Retriable Broker
Messages are written to the log, but to fewer in-sync replicas than required.
Common Causes
- Message was written to the leader's log but ISR shrank between the append and the ack phase — another broker left ISR during the window
- High write throughput causing followers to intermittently fall behind ISR threshold during peak load, triggering post-append ISR shrink
- Network instability causing brief follower disconnects that temporarily remove them from ISR after the write already succeeded on the leader
Solutions
- This is retriable: producer will resend; to avoid duplicates, enable idempotent producer ('enable.idempotence=true') which deduplicates retries via sequence numbers
- Investigate why followers are lagging — check replica fetcher thread count (num.replica.fetchers) and network bandwidth between brokers
- For consistent acks=all guarantees, tune 'min.insync.replicas' to be at most replication-factor minus 1 so a single follower hiccup does not block every write
Diagnostic Commands
# Check for under-replicated partitions
kafka-topics.sh --describe --bootstrap-server localhost:9092 --under-replicated-partitions
# Check replica offset lag and status
kafka-log-dirs.sh --bootstrap-server localhost:9092 --broker-list <follower-broker-id> --describe | grep offsetLagRelated 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.