Infinite pagination loop / duplicate records when paging an API (cursor or offset drift)
Paging through an API returned the same items repeatedly, skipped some, or never finished.
pagination infinite loopduplicate records paginationAPI pagination returns same pagenext page link loop Meaning
Offset pagination drifts when records are inserted or deleted while you page. Cursor APIs break when you reuse an old cursor, ignore has_more/next, or sort by a non-unique field.
Common causes
- Offset paging over data that changes
- Sort key not unique, so order is unstable
- Stopping condition wrong (empty page vs
nextmissing) - Cursor reused or modified
⚡ Quick fix
- Use cursor/keyset pagination
- Sort by a unique key (id, created_at + id)
- Stop when
nextis absent orhas_moreis false
Detailed fix by platform
Python
while url: r = get(url); items += r["data"]; url = r["links"].get("next")
How to diagnose
- Mode — Offset or cursor?
- Sort — Unique and stable?
- Stop — Based on next link?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in API
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 2 Dec 2026