43 — CursorNotFound

querytimeout

The server-side cursor has expired or does not exist

What is happening?

CursorNotFound is returned when the client tries to getMore from a cursor that the server no longer holds. Server-side cursors are cleaned up after the cursor lifetime expires (default 10 minutes of inactivity), after a primary failover, or when the cursor's originating mongos/mongod restarts. Long-running iteration, network interruptions, or replica set elections can all trigger this.

Common causes

  1. Iterating a large result set slower than the cursor timeout (default 10 min)
  2. Primary election or mongos restart invalidating open cursors
  3. Application paused (GC, deployment) between getMore calls
  4. Cursor was explicitly killed by another operation or db.killCursors()
  5. Using a cursor ID from a different connection or session

Diagnostic Steps

Related Issues