Kafka Error TRANSACTION_COORDINATOR_FENCED
Error code 52 · Non-retriable Transactions
Indicates that the transaction coordinator sending a WriteTxnMarker is no longer the current coordinator for a given producer.
Common Causes
- The transaction coordinator that sent WriteTxnMarker is no longer the leader for the __transaction_state partition — broker failover occurred mid-transaction
- Partition leadership for the relevant __transaction_state partition moved to another broker while a commit/abort was in flight
- Network partition caused a split-brain scenario where two brokers briefly believed they were the coordinator
Solutions
- The new coordinator will take over after leadership changes; let the client rediscover the coordinator and retry, and only recreate the producer if the client surfaces a fatal transactional error
- Ensure transaction.state.log.replication.factor is at least 3 and transaction.state.log.min.isr is at least 2 so coordinator failover does not leave the transaction log under-protected
- Monitor broker leader elections in JMX; frequent fencing events indicate network instability or an overloaded broker that should be investigated
Diagnostic Commands
# Inspect __transaction_state topic health
kafka-topics.sh --bootstrap-server localhost:9092 --describe --topic __transaction_state 2>&1 | grep -E 'Partition|Leader|Replicas|Isr'
# Look for transaction events in logs
grep 'TRANSACTION_COORDINATOR_FENCED\|WriteTxnMarker\|fenced coordinator' /var/log/kafka/server.log | tail -20Related APIs
This error can be returned by: Produce · WriteTxnMarkers
Debugging Kafka errors? Conduktor Console gives you real-time visibility into your cluster. Explore all errors in the Error Decoder.