Kafka Error INVALID_RECORD_STATE
Error code 121 · Non-retriable Producer
The record state is invalid. The acknowledgement of delivery could not be completed.
Common Causes
- In Share Groups (KIP-932), the consumer sent an acknowledgement for a record with an invalid state transition — e.g., acknowledging a record that was already acknowledged, released, or rejected by another consumer in the share group.
- Delivery acknowledgement was sent with a record offset that has already been redelivered to another consumer after an unacknowledged timeout, making the original consumer's ack stale.
- Application bug: the consumer attempted to acknowledge a record it never fetched in the current fetch session, or the acknowledgement type (accept/reject/release) doesn't match the current tracked state for that record on the broker.
Solutions
- Ensure each record is acknowledged exactly once per fetch session. Track acknowledgement state in the application layer and avoid duplicate acks. Upgrade to the latest Kafka client library to ensure correct Share Group protocol handling.
- Reduce the acknowledgement delay: acknowledge records before the record lock expires (`group.share.record.lock.duration.ms`) so the broker does not redeliver them and invalidate the original ack attempt.
- Review share group consumer logic to ensure ack calls use the exact offset and partition returned from the fetch response, and that acknowledgement type is appropriate (ACCEPT for successful processing, RELEASE to requeue, REJECT to dead-letter).
Diagnostic Commands
# Describe share group state and members
kafka-share-groups.sh --bootstrap-server localhost:9092 --describe --group <share-group-id>
# Look for share session events in logs
grep 'INVALID_RECORD_STATE\|ShareFetch\|acknowledgement' /var/log/kafka/server.log | tail -50Related APIs
This error can be returned by: ShareAcknowledge
Debugging Kafka errors? Conduktor Console gives you real-time visibility into your cluster. Explore all errors in the Error Decoder.