Automattic/mongoose · error · MongooseError

Invalid ref at path "${path}". Got ${util.inspect(ref, { dep

Error message

Invalid ref at path "${path}". Got ${util.inspect(ref, { depth: 0 })}

What it means

Error "Invalid ref at path "${path}". Got ${util.inspect(ref, { depth: 0 })}" thrown in Automattic/mongoose.

Source

Thrown at lib/helpers/populate/validateRef.js:17

'use strict';

const MongooseError = require('../../error/mongooseError');
const util = require('util');

module.exports = validateRef;

function validateRef(ref, path) {
  if (typeof ref === 'string') {
    return;
  }

  if (typeof ref === 'function') {
    return;
  }

  throw new MongooseError('Invalid ref at path "' + path + '". Got ' +
    util.inspect(ref, { depth: 0 }));
}

View on GitHub (pinned to 49cdab0136)

When it happens

Trigger: Thrown at lib/helpers/populate/validateRef.js:17 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/c799372a0123a877. Report an issue: GitHub.