Kafka Error INVALID_TIMESTAMP
Error code 32 · Non-retriable Producer
The timestamp of the message is out of acceptable range.
Common Causes
- Producer host clock is severely skewed (NTP drift or VM clock issues), causing message timestamps to fall outside the allowed CreateTime window enforced by message.timestamp.before.max.ms or message.timestamp.after.max.ms
- Application is manually setting ProducerRecord timestamps to stale or future values (for example replaying historical events) without adjusting broker or topic policy
- message.timestamp.type=CreateTime combined with tight message.timestamp.before.max.ms or message.timestamp.after.max.ms rejects records whose timestamps are too far from broker time
Solutions
- Sync producer host clocks via NTP (chronyc tracking / timedatectl status) and ensure clock skew stays within the topic or broker limits for message.timestamp.before.max.ms and message.timestamp.after.max.ms
- Increase message.timestamp.before.max.ms or message.timestamp.after.max.ms on the broker or topic if replaying historical or future-dated data is a valid use case
- Switch to log.message.timestamp.type=LogAppendTime for topics where producer clock accuracy cannot be guaranteed
Diagnostic Commands
# Check topic timestamp configuration
kafka-configs.sh --bootstrap-server localhost:9092 --entity-type topics --entity-name <topic> --describe | grep timestamp
# Search logs for related error messages
timedatectl show --property=NTPSynchronized,TimeUSec && chronyc tracking 2>/dev/null | grep 'RMS offset'Related APIs
This error can be returned by: Produce
Related KIPs
Debugging Kafka errors? Conduktor Console gives you real-time visibility into your cluster. Explore all errors in the Error Decoder.