pagination loop API Origin: Application & API OSI layer 7 · Application Last updated 2 Dec 2026

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.

Exact message you may see pagination infinite loopduplicate records paginationAPI pagination returns same pagenext page link loop
Seen on: Any

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 next missing)
  • Cursor reused or modified

⚡ Quick fix

  1. Use cursor/keyset pagination
  2. Sort by a unique key (id, created_at + id)
  3. Stop when next is absent or has_more is false

Detailed fix by platform

Python

  1. while url: r = get(url); items += r["data"]; url = r["links"].get("next")

How to diagnose

  1. Mode — Offset or cursor?
  2. Sort — Unique and stable?
  3. 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:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

410 Gone sunset — API: 410 Gone — this API version has been sunset / Deprecation and Sunset headers (API)410 Gone sunset429 — 429 quota exceeded (daily/monthly API limit) (HTTP)429batch size — API Error: Batch size exceeds maximum (max 100 items per request) / too many operations in one request (API)batch sizeinvalid_cursor — API Error: Invalid pagination cursor (invalid_cursor / cursor expired) (API)invalid_cursorlimit too large — API Error: limit must be less than or equal to 100 (page size exceeds maximum) (API)limit too largeResult window is too large — Elasticsearch: Result window is too large, from + size must be less than or equal to: [10000] (API)Result window is too …paginatio…

Explore the map of this error Full error map →

🧠 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.