Kafka Error OFFSET_OUT_OF_RANGE
Error code 1 · Non-retriable Consumer
The requested offset is not within the range of offsets maintained by the server.
Common Causes
- Consumer stored offset points to a segment that has since been deleted by retention policy (time or size-based)
- Consumer group was inactive for a long time and the committed offset fell behind the log start offset
- Topic was deleted and recreated, resetting offsets to 0, but consumer still holds the old committed offset
Solutions
- Set 'auto.offset.reset=earliest' on the consumer to fall back to the beginning of available data when the stored offset is out of range
- Use kafka-consumer-groups.sh --reset-offsets to explicitly reposition the consumer group to --to-earliest, --to-latest, or --to-datetime <timestamp>
- If data loss is a concern, increase log retention: set 'log.retention.hours' or 'log.retention.bytes' on the topic to ensure offsets remain valid longer than your consumer SLA
Diagnostic Commands
# Describe consumer group offsets and lag
kafka-consumer-groups.sh --bootstrap-server localhost:9092 --group <group> --describe
# Check earliest and latest offsets for the topic
kafka-get-offsets.sh --bootstrap-server localhost:9092 --topic <topic> --time -2
# Check latest offsets
kafka-get-offsets.sh --bootstrap-server localhost:9092 --topic <topic> --time -1Related APIs
This error can be returned by: DeleteRecords · Fetch · ListOffsets
Debugging Kafka errors? Conduktor Console gives you real-time visibility into your cluster. Explore all errors in the Error Decoder.