Automattic/mongoose · error · TypeError
Collection name cannot be empty
Error message
Collection name cannot be empty
What it means
Error "Collection name cannot be empty" thrown in Automattic/mongoose.
Source
Thrown at lib/utils.js:59
* @param {string} name a model name
* @param {Function} pluralize function that pluralizes the collection name
* @return {string} a collection name
* @api private
*/
exports.toCollectionName = function(name, pluralize) {
if (name === 'system.profile') {
return name;
}
if (name === 'system.indexes') {
return name;
}
if (typeof pluralize === 'function') {
if (typeof name !== 'string') {
throw new TypeError('Collection name must be a string');
}
if (name.length === 0) {
throw new TypeError('Collection name cannot be empty');
}
return pluralize(name);
}
return name;
};
/**
* Determines if `a` and `b` are deep equal.
*
* Modified from node/lib/assert.js
*
* @param {any} a a value to compare to `b`
* @param {any} b a value to compare to `a`
* @return {boolean}
* @api private
*/
exports.deepEqual = function deepEqual(a, b) {View on GitHub (pinned to 49cdab0136)
When it happens
Trigger: Thrown at lib/utils.js:59 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/4590a7fda8aa0573.
Report an issue: GitHub.