{"record":{"id":"035b532f1201a792","repo":"mongodb/node-mongodb-native","slug":"unrecognized-options","errorCode":null,"errorMessage":"Unrecognized options","messagePattern":"Unrecognized options","errorType":"exception","errorClass":"MongoRuntimeError","httpStatus":null,"severity":"error","filePath":"src/timeout.ts","lineNumber":170,"sourceCode":"\nfunction isCSOTTimeoutContextOptions(v: unknown): v is CSOTTimeoutContextOptions {\n  return (\n    v != null &&\n    typeof v === 'object' &&\n    'serverSelectionTimeoutMS' in v &&\n    typeof v.serverSelectionTimeoutMS === 'number' &&\n    'timeoutMS' in v &&\n    typeof v.timeoutMS === 'number'\n  );\n}\n\n/** @internal */\nexport abstract class TimeoutContext {\n  static create(options: TimeoutContextOptions): TimeoutContext {\n    if (options.session?.timeoutContext != null) return options.session?.timeoutContext;\n    if (isCSOTTimeoutContextOptions(options)) return new CSOTTimeoutContext(options);\n    else if (isLegacyTimeoutContextOptions(options)) return new LegacyTimeoutContext(options);\n    else throw new MongoRuntimeError('Unrecognized options');\n  }\n\n  abstract get maxTimeMS(): number | null;\n\n  abstract get serverSelectionTimeout(): Timeout | null;\n\n  abstract get connectionCheckoutTimeout(): Timeout | null;\n\n  abstract get clearServerSelectionTimeout(): boolean;\n\n  abstract get timeoutForSocketWrite(): Timeout | null;\n\n  abstract get timeoutForSocketRead(): Timeout | null;\n\n  abstract csotEnabled(): this is CSOTTimeoutContext;\n\n  abstract refresh(): void;\n","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/mongodb/node-mongodb-native/blob/dce7939f86fb283e167ad709955abedb7bf23124/src/timeout.ts#L152-L188","documentation":"Thrown by TimeoutContext.create() when the options object matches neither the CSOT shape (requires timeoutMS + serverSelectionTimeoutMS numbers) nor the Legacy shape (requires serverSelectionTimeoutMS + waitQueueTimeoutMS numbers). This is an internal factory used during operation execution to build the timeout context; reaching this branch means the options did not carry the required numeric fields.","triggerScenarios":"Internal driver code calling TimeoutContext.create() with an options object missing required numeric fields (serverSelectionTimeoutMS, waitQueueTimeoutMS, or timeoutMS). Not typically user-facing unless client options were constructed incorrectly at a low level.","commonSituations":"Rarely seen by end users. May surface if a custom MongoClient subclass or middleware strips timeout-related options from the client's internal configuration, or during driver version mismatches where the internal option shape changed.","solutions":["Avoid manually constructing or mutating the client's internal options object; use documented MongoClientOptions only.","Ensure you are on a compatible, non-corrupted driver version with a clean install (rm -rf node_modules && npm install).","If using a driver fork or wrapper, verify it passes through serverSelectionTimeoutMS and waitQueueTimeoutMS correctly."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await client.db('test').command({ ping: 1 });\n} catch (e) {\n  if (e instanceof MongoRuntimeError && /Unrecognized options/.test(e.message)) {\n    // rebuild client with standard MongoClientOptions; report driver version mismatch\n  } else throw e;\n}","preventionTips":["Do not manually mutate the client's internal options object.","Keep the driver version consistent across the dependency tree (deduplicate in node_modules).","Avoid forks/wrappers that strip internal timeout fields from client options."],"tags":["timeout","internal","configuration"],"backgroundTag":null,"analyzedSha":"dce7939f86fb283e167ad709955abedb7bf23124","analyzedAt":"2026-08-11T04:54:53.215Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}