{"record":{"id":"9b3b0cce51519e5a","repo":"Automattic/mongoose","slug":"unrecognized-bulkwrite-operation-name-op-name","errorCode":null,"errorMessage":"Unrecognized bulkWrite() operation name ${op.name}","messagePattern":"Unrecognized bulkWrite\\(\\) operation name (.+?)","errorType":"validation","errorClass":"MongooseError","httpStatus":null,"severity":"error","filePath":"lib/connection.js","lineNumber":481,"sourceCode":"    options = { ...options, session: asyncLocalStorage.session };\n  }\n\n  const now = this.base.now();\n\n  let res = null;\n  if (ordered) {\n    const opsToSend = [];\n    for (const op of ops) {\n      if (typeof op.model !== 'string' && !op.model?.[modelSymbol]) {\n        throw new MongooseError('Must specify model in Connection.prototype.bulkWrite() operations');\n      }\n      const Model = op.model[modelSymbol] ? op.model : this.model(op.model);\n\n      if (op.name == null) {\n        throw new MongooseError('Must specify operation name in Connection.prototype.bulkWrite()');\n      }\n      if (!Object.hasOwn(castBulkWrite.cast, op.name)) {\n        throw new MongooseError(`Unrecognized bulkWrite() operation name ${op.name}`);\n      }\n\n      await castBulkWrite.cast[op.name](Model, op, options, now);\n      opsToSend.push({ ...op, namespace: Model.namespace() });\n    }\n\n    res = await this.client.bulkWrite(opsToSend, options);\n  } else {\n    const validOps = [];\n    const validOpIndexes = [];\n    let validationErrors = [];\n    const asyncValidations = [];\n    const results = [];\n    for (let i = 0; i < ops.length; ++i) {\n      const op = ops[i];\n      if (typeof op.model !== 'string' && !op.model?.[modelSymbol]) {\n        const error = new MongooseError('Must specify model in Connection.prototype.bulkWrite() operations');\n        validationErrors.push({ index: i, error: error });","sourceCodeStart":463,"sourceCodeEnd":499,"githubUrl":"https://github.com/Automattic/mongoose/blob/49cdab01366679723b487ecb754b38570f783289/lib/connection.js#L463-L499","documentation":"Error \"Unrecognized bulkWrite() operation name ${op.name}\" thrown in Automattic/mongoose.","triggerScenarios":"Thrown at lib/connection.js:481 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"}