{"record":{"id":"5e0238590ba4939b","repo":"mongodb/node-mongodb-native","slug":"descriptors-missing-a-type-must-define-a-transform","errorCode":null,"errorMessage":"Descriptors missing a type must define a transform","messagePattern":"Descriptors missing a type must define a transform","errorType":"exception","errorClass":"MongoParseError","httpStatus":null,"severity":"error","filePath":"src/connection_string.ts","lineNumber":626,"sourceCode":"        break;\n      }\n      // The value should always be a string here, but since the array is typed as unknown\n      // there still needs to be an explicit cast.\n      // eslint-disable-next-line @typescript-eslint/no-base-to-string\n      mongoOptions[name] = String(values[0]);\n      break;\n    case 'record':\n      if (!isRecord(values[0])) {\n        throw new MongoParseError(`${name} must be an object`);\n      }\n      mongoOptions[name] = values[0];\n      break;\n    case 'any':\n      mongoOptions[name] = values[0];\n      break;\n    default: {\n      if (!transform) {\n        throw new MongoParseError('Descriptors missing a type must define a transform');\n      }\n      const transformValue = transform({ name, options: mongoOptions, values });\n      mongoOptions[name] = transformValue;\n      break;\n    }\n  }\n}\n\ninterface OptionDescriptor {\n  target?: string;\n  type?: 'boolean' | 'int' | 'uint' | 'record' | 'string' | 'any';\n  default?: any;\n\n  deprecated?: boolean | string;\n  /**\n   * @param name - the original option name\n   * @param options - the options so far for resolution\n   * @param values - the possible values in precedence order","sourceCodeStart":608,"sourceCodeEnd":644,"githubUrl":"https://github.com/mongodb/node-mongodb-native/blob/dce7939f86fb283e167ad709955abedb7bf23124/src/connection_string.ts#L608-L644","documentation":"Thrown by MongoParseError at src/connection_string.ts:626 in the `default` arm of `setOption` when an option descriptor has neither a known `type` nor a `transform`. This is an internal-driver invariant: every entry in the OPTIONS table must declare a type or a transform. End users should normally never see it; it indicates a bug in the driver's OPTIONS registry.","triggerScenarios":"Only reachable if someone modifies the OPTIONS object in src/connection_string.ts to add a descriptor with neither `type` nor `transform`. Triggered then by the driver attempting to apply that option.","commonSituations":"Forking the driver and adding an option incorrectly; running against an unreleased/patched driver version with an OPTIONS typo.","solutions":["If you maintain a fork, ensure every OPTIONS entry declares either `type` (one of boolean/int/uint/record/string/any) or a `transform` function.","If you are an end user, report this as a driver bug — no URI or options combination should trigger it on an official release.","Pin to a known-good driver version while the issue is investigated."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { new MongoClient(uri, options); } catch (e) { if (e instanceof MongoParseError && /Descriptors missing a type must define a transform/.test(e.message)) { console.error('Driver internal error — please report. Option registry is malformed.'); } else throw e; }","preventionTips":["Pin to an official published driver version rather than a fork.","If you maintain a fork, run the driver's own unit tests on the OPTIONS table before shipping."],"tags":["internal","options","driver-bug","configuration"],"backgroundTag":null,"analyzedSha":"dce7939f86fb283e167ad709955abedb7bf23124","analyzedAt":"2026-08-11T04:54:53.215Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}