Automattic/mongoose · error · CastError

Cast to Number failed for value ${stringValue} (type ${value

Error message

Cast to Number failed for value ${stringValue} (type ${valueType}) at path "skip"

What it means

Error "Cast to Number failed for value ${stringValue} (type ${valueType}) at path "skip"" thrown in Automattic/mongoose.

Source

Thrown at lib/query.js:973

 *
 * Cannot be used with `distinct()`
 *
 * @method skip
 * @memberOf Query
 * @instance
 * @param {number} val
 * @see cursor.skip https://www.mongodb.com/docs/manual/reference/method/cursor.skip/
 * @api public
 */

Query.prototype.skip = function skip(v) {
  this._validate('skip');

  if (typeof v === 'string') {
    try {
      v = castNumber(v);
    } catch {
      throw new CastError('Number', v, 'skip');
    }
  }

  this.options.skip = v;
  return this;
};

/**
 * Specifies the batchSize option.
 *
 * #### Example:
 *
 *     query.batchSize(100)
 *
 * #### Note:
 *
 * Cannot be used with `distinct()`
 *

View on GitHub (pinned to 49cdab0136)

When it happens

Trigger: Thrown at lib/query.js:973 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Automattic/mongoose@49cdab0136 (2026-08-21). Data as JSON: /api/errors/6e00ff91680e4075. Report an issue: GitHub.