{"record":{"id":"32333451eaf97bbe","repo":"redis/jedis","slug":"could-not-get-master-address-from","errorCode":null,"errorMessage":"Could not get master address from {}.","messagePattern":"Could not get master address from (.+?)\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/main/java/redis/clients/jedis/providers/SentineledConnectionProvider.java","lineNumber":276,"sourceCode":"        sentinelClientConfig)) {\n\n        List<String> masterAddr = jedis.sentinelGetMasterAddrByName(masterName);\n\n        // connected to sentinel...\n        sentinelAvailable = true;\n\n        if (masterAddr == null || masterAddr.size() != 2) {\n          LOG.warn(\"Sentinel {} is not monitoring master {}.\", sentinel, masterName);\n          continue;\n        }\n\n        master = toHostAndPort(masterAddr);\n        LOG.debug(\"Redis master reported at {}.\", master);\n        break;\n      } catch (JedisException e) {\n        // resolves #1036, it should handle JedisException there's another chance\n        // of raising JedisDataException\n        LOG.warn(\"Could not get master address from {}.\", sentinel, e);\n      }\n    }\n\n    if (master == null) {\n      if (sentinelAvailable) {\n        // can connect to sentinel, but master name seems to not monitored\n        throw new JedisException(\n            \"Can connect to sentinel, but \" + masterName + \" seems to be not monitored.\");\n      } else {\n        throw new JedisConnectionException(\n            \"All sentinels down, cannot determine where \" + masterName + \" is running.\");\n      }\n    }\n\n    LOG.info(\"Redis master running at {}. Starting sentinel listeners...\", master);\n\n    for (HostAndPort sentinel : sentinels) {\n","sourceCodeStart":258,"sourceCodeEnd":294,"githubUrl":"https://github.com/redis/jedis/blob/6dac31d4c224fb3257c216f3985340c6f500cdcb/src/main/java/redis/clients/jedis/providers/SentineledConnectionProvider.java#L258-L294","documentation":"In SentineledConnectionProvider.initSentinels(), any JedisException thrown while querying a Sentinel (connecting to it or calling sentinelGetMasterAddrByName) is caught and logged as this warning, and the provider tries the next Sentinel. This exists because the query itself can raise JedisDataException or connection-level JedisException (issue #1036). If every Sentinel fails and none reported a master, initialization then fails with a JedisException ('Could not connect to sentinel' or, when Sentinels were reachable but no master found, the master-not-monitored message).","triggerScenarios":"sentinelGetMasterAddrByName or the Sentinel connection itself throws JedisException for a given Sentinel node — e.g. connection refused/timeout to the Sentinel, Sentinel returning a data error (JedisDataException), or Sentinel resetting the connection mid-query.","commonSituations":"Sentinel host/port misconfigured (wrong port, firewall, DNS); Sentinel process down while others also down; Sentinel quota/auth issues returning data errors; all Sentinels unreachable so the client cannot resolve the master at startup.","solutions":["Verify each Sentinel is reachable: telnet/redis-cli -p <sentinel-port> PING on every configured Sentinel address.","Correct the Sentinel host:port list in the client configuration.","Run 'SENTINEL get-master-addr-by-name <masterName>' manually; if it errors, check the Sentinel logs for data/authorization errors.","Run at least 3 Sentinels with proper quorum so a single down node does not block master discovery.","Retry client initialization once the Sentinels are back (or add application-level retry around client construction)."],"exampleFix":"// before\nSet<String> sentinels = new HashSet<>(Arrays.asList(\"sentinel1:26379\")); // single, down\n// after\nSet<String> sentinels = new HashSet<>(Arrays.asList(\n  \"sentinel1:26379\", \"sentinel2:26379\", \"sentinel3:26379\")); // redundancy + quorum","handlingStrategy":"retry","validationCode":"for (String s : sentinels) {\n  String[] hp = s.split(\":\");\n  try (Jedis j = new Jedis(hp[0], Integer.parseInt(hp[1]))) {\n    if (\"PONG\".equals(j.ping())) continue; // sentinel reachable\n  }\n  throw new IllegalStateException(\"Sentinel unreachable: \" + s);\n}","typeGuard":null,"tryCatchPattern":"int attempts = 0;\nwhile (attempts++ < 3) {\n  try {\n    pool = new JedisSentinelPool(masterName, sentinels, config);\n    break;\n  } catch (JedisException e) {\n    if (attempts == 3) throw new IllegalStateException(\"Could not resolve master from any Sentinel after retries\", e);\n    Thread.sleep(1000L * attempts); // Sentinels may be transiently down\n  }\n}","preventionTips":["Run at least 3 Sentinels with a proper quorum so one down node never blocks master discovery.","Verify Sentinel host:port reachability (firewall, DNS, port) before startup; test with redis-cli PING.","Wrap client construction in bounded retries — the provider itself tries each Sentinel once.","Watch Sentinel logs for JedisDataException sources such as auth or quota errors."],"tags":["redis-sentinel","jedis-exception","connection-timeout","high-availability","startup"],"backgroundTag":"http-request-failed","analyzedSha":"6dac31d4c224fb3257c216f3985340c6f500cdcb","analyzedAt":"2026-09-08T04:55:01.204Z","contentChangedAt":"2026-09-08T04:55:01.204Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}