{"record":{"id":"4b4c5d63792030d1","repo":"redis/node-redis","slug":"couldn-t-connect-to-any-sentinel-node","errorCode":null,"errorMessage":"Couldn't connect to any sentinel node","messagePattern":"Couldn't connect to any sentinel node","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/client/lib/sentinel/index.ts","lineNumber":1714,"sourceCode":"      try {\n        await client.connect();\n      } catch {\n        if (client.isOpen) {\n          client.destroy();\n        }\n        continue;\n      }\n\n      try {\n        const sentinelData = await client.sentinel.sentinelSentinels(this.options.name);\n        this.#sentinelRootNodes = [node].concat(createNodeList(sentinelData));\n        return;\n      } finally {\n        client.destroy();\n      }\n    }\n\n    throw new Error(\"Couldn't connect to any sentinel node\");\n  }\n\n  async getMasterNode() {\n    let connected = false;\n\n    for (const node of this.#sentinelRootNodes) {\n      const client = RedisClient.create({\n        ...this.options.sentinelClientOptions,\n        socket: {\n          ...this.options.sentinelClientOptions?.socket,\n          host: node.host,\n          port: node.port,\n          reconnectStrategy: false\n        },\n        modules: RedisSentinelModule\n      }).on('error', err => this.emit(`getMasterNode: ${err}`));\n\n      try {","sourceCodeStart":1696,"sourceCodeEnd":1732,"githubUrl":"https://github.com/redis/node-redis/blob/90fd0652bc3f2a0a1b2f79fa9096b02a86b0ac58/packages/client/lib/sentinel/index.ts#L1696-L1732","documentation":"A discovery routine iterates the known sentinel root nodes to call `SENTINEL SENTINELS` and learn the full sentinel list; if no node could be connected to (every iteration `continue`d past failures), the loop ends and throws. It is the bootstrap-discovery counterpart to the observe() connectivity failure.","triggerScenarios":"Calling the sentinel-list discovery path when every root node is unreachable or errors on `SENTINEL SENTINELS`. Reached during initial connect / topology refresh.","commonSituations":"Cold start with all seed sentinels down; wrong sentinel port; auth mismatch on sentinelClientOptions; firewall blocking the sentinel port (commonly 26379).","solutions":["Confirm at least one sentinel seed is reachable and authenticated.","Fix `sentinelClientOptions` password / TLS to match the sentinels.","Open the sentinel port (default 26379) in the network/firewall.","Supply additional healthy seeds in `rootNodes`."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"async function pingSentinels(rootNodes: { host: string; port: number }[]): Promise<boolean> {\n  for (const n of rootNodes) {\n    try {\n      const s = new net.Socket();\n      await new Promise<void>((res, rej) => { s.setTimeout(1000).once('connect', () => { s.destroy(); res(); }).once('error', rej).once('timeout', () => rej(new Error('timeout'))).connect(n.port, n.host); });\n      return true;\n    } catch { /* next */ }\n  }\n  return false;\n}","typeGuard":null,"tryCatchPattern":"for (let i = 0; i < 5; i++) {\n  try { await sentinel.connect(); break; }\n  catch (e) {\n    if (String(e).includes(\"Couldn't connect to any sentinel node\") && i < 4) {\n      await new Promise(r => setTimeout(r, 500 * 2 ** i)); continue;\n    }\n    throw e;\n  }\n}","preventionTips":["Open sentinel ports in firewalls (default 26379).","Keep >= 3 sentinel seeds across hosts/zones."],"tags":["sentinel","network","discovery","connectivity"],"backgroundTag":null,"analyzedSha":"90fd0652bc3f2a0a1b2f79fa9096b02a86b0ac58","analyzedAt":"2026-08-11T15:37:21.243Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}