Kafka Offset Out of Range
This failure occurs when the requested offset is before the log start offset or after the log end offset.
Establish the Data Boundary
Section titled “Establish the Data Boundary”Capture the exception's topic-partition and requested offset, the committed offset, current log start/end offsets, retention changes, topic recreation history, and any restore or migration operation.
kafka-consumer-groups.sh --bootstrap-server kafka:9092 \ --describe --group orders-consumerkafka-get-offsets.sh --bootstrap-server kafka:9092 \ --topic orders --time earliestkafka-get-offsets.sh --bootstrap-server kafka:9092 \ --topic orders --time latestChoose the Recovery Semantics
Section titled “Choose the Recovery Semantics”| Choice | Consequence |
|---|---|
| Earliest retained | Replays all data still available |
| Latest | Skips retained backlog |
| Timestamp | Starts at the first retained record at/after a business time |
| Explicit offset | Requires partition-specific validation |
Stop the group and preview the reset:
kafka-consumer-groups.sh --bootstrap-server kafka:9092 \ --group orders-consumer --topic orders \ --reset-offsets --to-earliest --dry-runRetain the dry-run CSV or command output and obtain application-owner approval before replacing --dry-run with --execute.
Warning
An offset reset can replay side effects or skip unprocessed records. Confirm idempotency, downstream deduplication, and the accepted data-loss/replay boundary.
Verify
Section titled “Verify”Restart the group, confirm its position matches the approved plan, processing and commits advance, and replayed records do not create unacceptable duplicate effects.
Prevent Recurrence
Section titled “Prevent Recurrence”Set retention from maximum outage plus recovery time, monitor time lag as well as offset lag, keep consumers from remaining offline beyond retention, and validate offsets during migration/restore.