Kafka Error UNKNOWN_PRODUCER_ID
Error code 59 · Non-retriable Producer
This exception is raised by the broker if it could not locate the producer metadata associated with the producerId in question. This could happen if, for instance, the producer's records were deleted because their retention time had elapsed. Once the last records of the producerId are removed, the producer's metadata is removed from the broker, and future appends by the producer will return this exception.
Reviewed 2026-10-27 · 4.4.0 · source-reviewed. Source
Common Causes
- The broker no longer has the producer state needed to validate the batch; retention, log truncation or state expiry can be involved.
Solutions
- Inspect the final delivery result and client logs. Kafka Java 4.4 handles several UNKNOWN_PRODUCER_ID cases internally with sequence resets or epoch changes; do not recreate the producer on every logged response.
- If the error escapes to application code, follow the client transaction/error contract. Re-sending records through a new producer session can duplicate writes whose outcome was ambiguous.
Diagnostic Commands
# Look for related errors in broker logs
grep 'UNKNOWN_PRODUCER_ID\|UnknownProducerIdException\|ProducerStateManager' /path/to/kafka/logs/server.log | tail -30
# Check topic retention and cleanup settings
kafka-configs.sh --bootstrap-server localhost:9092 --entity-type topics --entity-name <topic> --describe | grep -E 'retention|cleanup.policy|min.compaction.lag|max.compaction.lag'Related APIs
This error can be returned by: Produce
Related KIPs
Java Exception
In the Java client this surfaces as UnknownProducerIdException.
Debugging Kafka errors? Conduktor Console gives you real-time visibility into your cluster. Explore all errors in the Error Decoder.