In PlanExecutor::getNextImpl(), we will construct a CappedInsertNotifier if shouldWaitForInserts() returns true. Then, if we reach EOF, we will call waitForInserts() if shouldWaitForInserts() returns true. waitForInserts() invariants that the CappedInsertNotifier exists. This means that we can hit the invariant if shouldWaitForInserts() returns false and then later returns true. This can happen if the request specifies a lastKnownCommittedOpTime that is greater than the node's last committed op time and then the node's last committed op time moves forward so that the values are equal. That would cause this check to return false and then true. It is legal in replication for the downstream node to have a higher view of the committed op time than its sync source, so this code must be robust to that event.