{"record":{"id":"8ea7d6d33f2441c7","repo":"Automattic/mongoose","slug":"error-must-be-instanceof-error","errorCode":null,"errorMessage":"`error` must be `instanceof Error`.","messagePattern":"`error` must be `instanceof Error`\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/utils.js","lineNumber":1031,"sourceCode":"    }\n    if (source[name] != null) {\n      return source[name];\n    }\n  }\n\n  return null;\n};\n\n/*!\n * ignore\n */\n\nexports.noop = function() {};\n\nexports.errorToPOJO = function errorToPOJO(error) {\n  const isError = error instanceof Error;\n  if (!isError) {\n    throw new Error('`error` must be `instanceof Error`.');\n  }\n\n  const ret = {};\n  for (const properyName of Object.getOwnPropertyNames(error)) {\n    ret[properyName] = error[properyName];\n  }\n  return ret;\n};\n\n/*!\n * ignore\n */\n\nexports.warn = function warn(message) {\n  return process.emitWarning(message, { code: 'MONGOOSE' });\n};\n\n","sourceCodeStart":1013,"sourceCodeEnd":1049,"githubUrl":"https://github.com/Automattic/mongoose/blob/49cdab01366679723b487ecb754b38570f783289/lib/utils.js#L1013-L1049","documentation":"Error \"`error` must be `instanceof Error`.\" thrown in Automattic/mongoose.","triggerScenarios":"Thrown at lib/utils.js:1031 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49cdab01366679723b487ecb754b38570f783289","analyzedAt":"2026-08-21T22:54:00.882Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}