{"record":{"id":"fb562b73753bd969","repo":"redis/jedis","slug":"can-connect-to-sentinel-but-mastername-seems-t","errorCode":null,"errorMessage":"Can connect to sentinel, but ${masterName} seems to be not monitored.","messagePattern":"Can connect to sentinel, but (.+?) seems to be not monitored\\.","errorType":"exception","errorClass":"JedisException","httpStatus":null,"severity":"critical","filePath":"src/main/java/redis/clients/jedis/providers/SentineledConnectionProvider.java","lineNumber":283,"sourceCode":"        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\n      SentinelListener listener = new SentinelListener(sentinel);\n      // whether SentinelListener threads are alive or not, process can be stopped\n      listener.setDaemon(true);\n      sentinelListeners.add(listener);\n      listener.start();\n    }\n","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/redis/jedis/blob/6dac31d4c224fb3257c216f3985340c6f500cdcb/src/main/java/redis/clients/jedis/providers/SentineledConnectionProvider.java#L265-L301","documentation":"SentineledConnectionProvider.initSentinels() reached and communicated with at least one sentinel, but none of them know a master with the configured masterName, so it throws JedisException. This means the sentinel quorum is monitoring different masters than the client expects.","triggerScenarios":"Building JedisSentinelPool / RedisSentinelClient / SentineledConnectionProvider with a masterName that no monitored master matches, e.g. masterName(\"mymaster\") while sentinels monitor \"prod-master\".","commonSituations":"Typos in the master name; pointing the client at a sentinel cluster from a different deployment/environment (staging sentinels vs prod master name); sentinel was reconfigured (SENTINEL REMOVE) so the name no longer exists; copy-paste of sentinel endpoints without updating the master name.","solutions":["Run SENTINEL masters (or redis-cli -p 26379 sentinel get-master-addr-by-name <name>) to list monitored masters and use the exact configured name.","Correct the masterName in your client configuration to match what the sentinels monitor.","Add the master to sentinel monitoring (SENTINEL MONITOR <name> <ip> <port> <quorum>) if it is genuinely unmonitored.","Verify you are connecting to the sentinel set belonging to your environment."],"exampleFix":"// before\nnew JedisSentinelPool(\"mymaster\", sentinels);\n// after\nnew JedisSentinelPool(\"prod-master\", sentinels); // name confirmed via SENTINEL masters","handlingStrategy":"try-catch","validationCode":"try (Jedis s = new Jedis(sentinelHost, 26379)) {\n  List<String> m = s.sentinelGetMasterAddrByName(masterName);\n  if (m == null || m.isEmpty()) throw new IllegalStateException(\"Sentinel does not monitor master '\" + masterName + \"'\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  pool = new JedisSentinelPool(masterName, sentinels, clientConfig);\n} catch (JedisException e) {\n  if (e.getMessage().contains(\"seems to be not monitored\")) {\n    throw new IllegalStateException(\"masterName '\" + masterName + \"' is not monitored by the sentinels — check SENTINEL masters\", e);\n  }\n  throw e;\n}","preventionTips":["Confirm masterName with `SENTINEL masters` against the actual sentinel set.","Keep master names in shared config for client and sentinel deployment.","Check sentinel connectivity and monitored names at startup before creating the pool.","Watch for SENTINEL REMOVE/rename operations in ops runbooks."],"tags":["jedis","sentinel","configuration","redis"],"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"}