#14794·meteor

Async cursor reads swallow errors: fetchAsync resolves [] instead of rejecting

Author: MaxTwentythreeCreated Sep 25, 2026Updated Sep 25, 2026

Hi,

since 3.3.1, a failed read on the server doesn't throw anymore. fetchAsync, forEachAsync and findOneAsync just stop early, so you get fewer docs, [] or undefined. The error only shows up in console.error.

Repro

javascript
const Items = new Mongo.Collection("items");

await Items.find({ $foo: 1 }).fetchAsync(); // resolves to []
await Items.findOneAsync({ $foo: 1 });      // resolves to undefined

MongoDB's "unknown top level operator: $foo" error is only logged. The raw driver rejects as expected:

javascript
await Items.rawCollection().find({ $foo: 1 }).toArray(); // rejects with MongoServerError

Expected: the Meteor calls reject with the MongoDB error too.

Cause

#13786 (the cursor-leak fix) made _rawNextObjectPromise in packages/mongo/asynchronous_cursor.js await next() inside a try that only logs:

javascript
try {
  this._pendingNext = this._dbCursor.next();
  const result = await this._pendingNext;
  this._pendingNext = null;
  return result;
} catch (e) {
  console.error(e);
}

Before, it returned this._dbCursor.next() without awaiting, so errors reached the caller.

Fix

Rethrow, and keep the finally. The internal callers already handle errors: the oplog tail loop catches them, the polling observer reports query errors, and the oplog observer retries. Right now that code never runs, because the error never reaches it.

Why it matters

During a network blip or failover, app code can't tell "no documents" from "the read failed", and may act on an empty result, like cleanup or delete logic.

Meteor 3.5.2, Node 24.15.0.