mongodb/node-mongodb-native · error · MongoTailableCursorError

Tailable cursor does not support skip

Error message

Tailable cursor does not support skip

What it means

Thrown as MongoTailableCursorError by FindCursor.skip() when findOptions.tailable is true. Tailable cursors start from the current end of a capped collection and stream new inserts; skip is meaningless for that model and the server does not support it on tailable cursors, so the driver rejects it client-side.

Source

Thrown at src/cursor/find_cursor.ts:487

    }

    if (typeof value !== 'number') {
      throw new MongoInvalidArgumentError('Operation "limit" requires an integer');
    }

    this.findOptions.limit = value;
    return this;
  }

  /**
   * Set the skip for the cursor.
   *
   * @param value - The skip for the cursor query.
   */
  skip(value: number): this {
    this.throwIfInitialized();
    if (this.findOptions.tailable) {
      throw new MongoTailableCursorError('Tailable cursor does not support skip');
    }

    if (typeof value !== 'number') {
      throw new MongoInvalidArgumentError('Operation "skip" requires an integer');
    }

    this.findOptions.skip = value;
    return this;
  }
}

View on GitHub (pinned to 3366c21a63)

Solutions

  1. Remove .skip() on tailable cursors
  2. If you need to start from a specific point, filter on a timestamp/_id in the query rather than skip
  3. Use a non-tailable query on the capped collection if you need skip

Example fix

// before
coll.find({}, { tailable: true }).skip(10);
// after
coll.find({ ts: { $gt: lastSeenTs } }, { tailable: true, awaitData: true });
Defensive patterns

Strategy: validation

Validate before calling

function skipSafe(cursor, n) {
  if (cursor.findOptions?.tailable) {
    throw new Error('cannot skip on a tailable cursor; filter by timestamp/_id instead');
  }
  return cursor.skip(n);
}

Prevention

When it happens

Trigger: coll.find({}, { tailable: true }).skip(5) or coll.find({}, { tailable: true, awaitData: true }).skip(N).

Common situations: Reusing a find-options preset with skip on a tailable query; attempting pagination semantics on a tailing cursor.

Related errors


AI-assisted analysis of mongodb/node-mongodb-native@3366c21a63 (2026-08-04). Data as JSON: /data/errors/f98fad4846a83ede.json. Report an issue: GitHub.