redis/jedis · critical · JedisException
Can connect to sentinel, but
Error message
Can connect to sentinel, but ${masterName} seems to be not monitored. What it means
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.
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.
Example fix
// before
new JedisSentinelPool("mymaster", sentinels);
// after
new JedisSentinelPool("prod-master", sentinels); // name confirmed via SENTINEL masters Defensive patterns
Strategy: try-catch
Validate before calling
try (Jedis s = new Jedis(sentinelHost, 26379)) {
List<String> m = s.sentinelGetMasterAddrByName(masterName);
if (m == null || m.isEmpty()) throw new IllegalStateException("Sentinel does not monitor master '" + masterName + "'");
} Try / catch
try {
pool = new JedisSentinelPool(masterName, sentinels, clientConfig);
} catch (JedisException e) {
if (e.getMessage().contains("seems to be not monitored")) {
throw new IllegalStateException("masterName '" + masterName + "' is not monitored by the sentinels — check SENTINEL masters", e);
}
throw e;
} Prevention
- 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.
When it happens
Trigger: Building JedisSentinelPool / RedisSentinelClient / SentineledConnectionProvider with a masterName that no monitored master matches, e.g. masterName("mymaster") while sentinels monitor "prod-master".
Common situations: 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.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Can connect to sentinel, but
- Master name is required for Sentinel mode
- At least one sentinel must be specified for Sentinel mode
- No nodes to initialize cluster slots cache.
- All sentinels down, cannot determine where
AI-assisted analysis of redis/jedis@6dac31d4c2 (2026-09-08).
Data as JSON: /api/errors/fb562b73753bd969.
Report an issue: GitHub.
Appendix: source
Thrown at src/main/java/redis/clients/jedis/providers/SentineledConnectionProvider.java:283
if (masterAddr == null || masterAddr.size() != 2) {
LOG.warn("Sentinel {} is not monitoring master {}.", sentinel, masterName);
continue;
}
master = toHostAndPort(masterAddr);
LOG.debug("Redis master reported at {}.", master);
break;
} catch (JedisException e) {
// resolves #1036, it should handle JedisException there's another chance
// of raising JedisDataException
LOG.warn("Could not get master address from {}.", sentinel, e);
}
}
if (master == null) {
if (sentinelAvailable) {
// can connect to sentinel, but master name seems to not monitored
throw new JedisException(
"Can connect to sentinel, but " + masterName + " seems to be not monitored.");
} else {
throw new JedisConnectionException(
"All sentinels down, cannot determine where " + masterName + " is running.");
}
}
LOG.info("Redis master running at {}. Starting sentinel listeners...", master);
for (HostAndPort sentinel : sentinels) {
SentinelListener listener = new SentinelListener(sentinel);
// whether SentinelListener threads are alive or not, process can be stopped
listener.setDaemon(true);
sentinelListeners.add(listener);
listener.start();
}
View on GitHub (pinned to 6dac31d4c2)