Kafka Error TRANSACTION_ABORTABLE
Error code 120 · Non-retriable Transactions
The server encountered an error with the transaction. The client can abort the transaction to continue using this transactional ID.
Common Causes
- A transactional operation (produce or offset commit) encountered a server-side error (e.g., out-of-order sequence, epoch mismatch) that corrupted the transaction state to a point where continuing is not possible, but the transaction can still be cleanly aborted.
- Producer epoch was fenced mid-transaction: another producer instance with the same `transactional.id` started and incremented the epoch, making the current transaction's records invalid but still abortable.
- Broker returned an error (e.g., `INVALID_PRODUCER_EPOCH` or sequence gap) during a `Produce` request within an ongoing transaction, leaving the transaction in a partial/abortable state.
Solutions
- Call `producer.abortTransaction()` immediately upon receiving this error, then you can reuse the same producer instance to start a new transaction with `producer.beginTransaction()`. Do NOT close and recreate the producer unless `abortTransaction()` also fails.
- If `abortTransaction()` also fails (returns a fatal exception), close the producer and recreate it. This re-initializes the producer epoch and clears fencing state.
- Ensure only one active producer instance per `transactional.id` at any time. Use proper leader election or distributed locking in your application to prevent dual-producer scenarios that cause epoch fencing.
Diagnostic Commands
# Inspect transaction-state topic health
kafka-topics.sh --bootstrap-server localhost:9092 --describe --topic __transaction_state | grep -E 'Leader|Isr|Replicas'
# Look for transaction events in logs
grep 'TRANSACTION_ABORTABLE\|abortTransaction\|transactional.id\|ProducerFenced' /var/log/kafka/server.log | tail -50Related APIs
This error can be returned by: AddOffsetsToTxn · AddPartitionsToTxn · EndTxn · InitProducerId
Debugging Kafka errors? Conduktor Console gives you real-time visibility into your cluster. Explore all errors in the Error Decoder.