{"id":"95df6e12348c0a3c","repo":"redis/node-redis","slug":"master-node-not-enumerated","errorCode":null,"errorMessage":"Master Node Not Enumerated","messagePattern":"Master Node Not Enumerated","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/client/lib/sentinel/index.ts","lineNumber":1758,"sourceCode":"\n      connected = true;\n\n      try {\n        const masterData = await client.sentinel.sentinelMaster(this.options.name);\n\n        const master = parseNode(masterData);\n        if (master === undefined) {\n          continue;\n        }\n\n        return master;\n      } finally {\n        client.destroy();\n      }\n    }\n\n    if (connected) {\n      throw new Error(\"Master Node Not Enumerated\");\n    }\n\n    throw new Error(\"couldn't connect to any sentinels\");\n  }\n\n  async getMasterClient() {\n    const master = await this.getMasterNode();\n    const socket = getMappedNode(master.host, master.port, this.options.nodeAddressMap);\n    return RedisClient.create({\n      ...this.options.nodeClientOptions,\n      socket: {\n        ...this.options.nodeClientOptions?.socket,\n        host: socket.host,\n        port: socket.port\n      }\n    });\n  }\n","sourceCodeStart":1740,"sourceCodeEnd":1776,"githubUrl":"https://github.com/redis/node-redis/blob/bb5beb56578573910e2ee8f39681edc214c41398/packages/client/lib/sentinel/index.ts#L1740-L1776","documentation":"Thrown by RedisSentinelFactory.getMasterNode() when `connected` is true (at least one sentinel accepted a connection) but parseNode(masterData) returned undefined for every sentinel tried (sentinel/index.ts:1757). So the sentinels are reachable but none could resolve a valid master for options.name — the master name is unknown to them or its record is unparseable.","triggerScenarios":"Calling getMasterNode() with options.name that the reachable sentinels do not monitor; sentinel returns a master record missing host/port or flagged such that parseNode rejects it.","commonSituations":"Mismatched master name between client config and sentinel.conf; pointing at a sentinel pool for a different deployment; sentinel recently reconfigured and the master record is empty.","solutions":["Run `sentinel masters` on a reachable sentinel and confirm options.name is listed with valid host/port.","Fix the master name in RedisSentinelFactory options to match sentinel.conf exactly (case-sensitive).","If the master record is malformed, check the sentinel health/version and re-add the monitor (`SENTINEL MONITOR`)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Confirm a reachable sentinel knows the master name before calling getMasterNode().\nasync function assertMasterKnown(sentinelNode, name) {\n  const c = createClient({ socket: sentinelNode });\n  c.on('error', () => {});\n  await c.connect();\n  try {\n    const masters = await c.sentinel.sentinelMasters();\n    const m = masters.find(x => x.name === name);\n    if (!m || !m.host || !m.port) throw new Error(`sentinel has no valid master for '${name}'`);\n  } finally {\n    await c.destroy();\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  const master = await factory.getMasterNode();\n} catch (e) {\n  if (e instanceof Error && /Master Node Not Enumerated/.test(e.message)) {\n    // master name mismatch — recheck options.name against sentinel.conf\n  }\n  throw e;\n}","preventionTips":["Source options.name from the same config as the sentinel's monitor directive.","Run `SENTINEL MASTERS` during deploys to confirm the name/host/port are present.","Centralize master-name config so client and sentinel cannot drift."],"tags":["sentinel","configuration","master","factory"],"analyzedSha":"bb5beb56578573910e2ee8f39681edc214c41398","analyzedAt":"2026-08-03T19:09:15.686Z","schemaVersion":2}