{"id":"ddbddb5e4168a320","repo":"redis/node-redis","slug":"couldn-t-connect-to-any-sentinels","errorCode":null,"errorMessage":"couldn't connect to any sentinels","messagePattern":"couldn't connect to any sentinels","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/client/lib/sentinel/index.ts","lineNumber":1761,"sourceCode":"      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\n  async getReplicaNodes() {\n    let connected = false;\n","sourceCodeStart":1743,"sourceCodeEnd":1779,"githubUrl":"https://github.com/redis/node-redis/blob/bb5beb56578573910e2ee8f39681edc214c41398/packages/client/lib/sentinel/index.ts#L1743-L1779","documentation":"Thrown by RedisSentinelFactory.getMasterNode() when `connected` stayed false — client.connect() failed for every node in #sentinelRootNodes (sentinel/index.ts:1761). Distinct from error 86: here we never reached a sentinel at all, so we could not even ask for the master.","triggerScenarios":"Calling getMasterNode() when all sentinel seeds are unreachable (network, wrong port, auth/TLS failure).","commonSituations":"Initial bootstrap against a misconfigured seed list; firewall blocking 26379; sentinelClientOptions password mismatch with requirepass; DNS not resolving the sentinel hostnames.","solutions":["Confirm sentinel seed host:port reachability from the client host.","Fix sentinelClientOptions auth/TLS to match the sentinels.","Provide redundant sentinel seeds across hosts/AZs.","Retry getMasterNode() with backoff during transient outages."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Same reachability pre-check as errors 83/85 before calling getMasterNode().\nif (!(await anySentinelReachable(factory.options.sentinelRootNodes))) {\n  throw new Error('no sentinel reachable — cannot resolve master');\n}","typeGuard":null,"tryCatchPattern":"async function getMasterWithRetry(factory, attempts = 5) {\n  for (let i = 0; i < attempts; i++) {\n    try {\n      return await factory.getMasterNode();\n    } catch (e) {\n      if (e instanceof Error && /couldn't connect to any sentinels/.test(e.message) && i < attempts - 1) {\n        await new Promise(r => setTimeout(r, 1000 * (i + 1)));\n        continue;\n      }\n      throw e;\n    }\n  }\n}","preventionTips":["Verify sentinel seed ports/auth before resolving the master.","Keep redundant seeds across AZs.","Retry with backoff during transient network issues."],"tags":["network","sentinel","connectivity","factory"],"analyzedSha":"bb5beb56578573910e2ee8f39681edc214c41398","analyzedAt":"2026-08-03T19:09:15.686Z","schemaVersion":2}