{"record":{"id":"89ff08d5de2153db","repo":"redis/jedis","slug":"can-not-get-master-addr-master-name-sentinel","errorCode":null,"errorMessage":"Can not get master addr, master name: {}. Sentinel: {}","messagePattern":"Can not get master addr, master name: (.+?)\\. Sentinel: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/main/java/redis/clients/jedis/JedisSentinelPool.java","lineNumber":264,"sourceCode":"\n    HostAndPort master = null;\n    boolean sentinelAvailable = false;\n\n    LOG.info(\"Trying to find master from available Sentinels...\");\n\n    for (HostAndPort sentinel : sentinels) {\n\n      LOG.debug(\"Connecting to Sentinel {}\", sentinel);\n\n      try (Jedis jedis = new Jedis(sentinel, 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(\"Can not get master addr, master name: {}. Sentinel: {}\", masterName, sentinel);\n          continue;\n        }\n\n        master = toHostAndPort(masterAddr);\n        LOG.debug(\"Found Redis master 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(\n          \"Cannot get master address from sentinel running @ {}. Reason: {}. Trying next one.\", 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(\"Can connect to sentinel, but \" + masterName","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/redis/jedis/blob/6dac31d4c224fb3257c216f3985340c6f500cdcb/src/main/java/redis/clients/jedis/JedisSentinelPool.java#L246-L282","documentation":"During JedisSentinelPool initialization, the client asks each Sentinel for the current master address of masterName via SENTINEL get-master-addr-by-name. If a reachable Sentinel replies with null or an address list that isn't [host, port], this warning is logged and the loop continues to the next Sentinel. Initialization only fails if every Sentinel is exhausted (then JedisException 'Could not get a resource from the Sentinel' follows).","triggerScenarios":"sentinelGetMasterAddrByName returns null or a list whose size != 2 from a live Sentinel — typically because masterName does not exist on that Sentinel, or the Sentinel hasn't finished discovering/monitoring the master.","commonSituations":"Typo in master name; Sentinels and master monitored under different names across environments; Sentinel started recently and hasn't learned the master yet; split network where some Sentinels know the master and others don't.","solutions":["Run `SENTINEL masters` (or `SENTINEL get-master-addr-by-name <name>`) on the Sentinel listed in the warning to check the name exists.","Fix the masterName in your client config to match the monitored name exactly (case-sensitive).","Ensure all Sentinels are configured with the same `sentinel monitor <name>` settings and can reach the master.","Wait for/verify Sentinel discovery — restart in a consistent order (master, replicas, sentinels).","Confirm the Sentinel port/auth in your sentinel list is correct so you are querying the intended Sentinel."],"exampleFix":"// before\nSet<String> sentinels = Set.of(\"sentinel1:26379\", \"sentinel2:26379\");\nJedisSentinelPool pool = new JedisSentinelPool(\"mymaster1\", sentinels); // typo\n// after\nJedisSentinelPool pool = new JedisSentinelPool(\"mymaster\", sentinels); // matches `sentinel monitor mymaster ...`","handlingStrategy":"retry","validationCode":"// verify before building the pool\ntry (Jedis s = new Jedis(sentinelHost, 26379)) {\n  List<String> addr = s.sentinelGetMasterAddrByName(masterName);\n  if (addr == null || addr.size() != 2) throw new IllegalArgumentException(\"unknown master: \" + masterName);\n}","typeGuard":null,"tryCatchPattern":"try { pool = new JedisSentinelPool(masterName, sentinels); } catch (JedisException e) { /* all sentinels failed: check names/connectivity */ }","preventionTips":["Verify masterName against `SENTINEL masters` on every configured Sentinel","Keep all Sentinels consistently configured with `sentinel monitor <name>`","Allow Sentinels time to discover the master after a fresh setup","Make Sentinel names part of deployment config validation"],"tags":["redis","sentinel","configuration","failover"],"backgroundTag":"resource-not-found","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"}