136 CappedPositionLost: Capped collection position lost
MongoDBWhat does it mean?
A cursor reading a capped (fixed-size) collection (typically a tailable cursor) lost its position. The document it was positioned on no longer exists because the collection overwrote it cyclically.
Why does it happen?
When a capped collection is full, the oldest documents are removed and overwritten automatically; a tailable cursor following a collection that is written faster than it can consume falls behind and its position is overwritten. Seen in consumers that tail capped structures such as the oplog.
How to fix it
Reposition the cursor (open a new tailable cursor) and restart tailing; catch this error in the application and refresh the read. If the root cause is a consumer that cannot keep up with the write rate: increase the capped collection/oplog size or speed up the consumer. To track changes reliably, use change streams instead of tailable cursors where possible.
More from this engine
- 7 HostNotFoundCould not find host
- 175 QueryPlanKilledQuery plan killed during execution
- 11602 InterruptedDueToReplStateChangeOperation interrupted due to a replication state change
- 28 PathNotViableCannot use the part of the path to traverse the element
- 216 ElectionInProgressElectionInProgress
- 225 TransactionTooOldTransactionTooOld
- 246 SnapshotUnavailableSnapshotUnavailable