redis/jedis · warning
Can not get master addr, master name
Error message
Can not get master addr, master name: {}. Sentinel: {} What it means
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).
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.
Example fix
// before
Set<String> sentinels = Set.of("sentinel1:26379", "sentinel2:26379");
JedisSentinelPool pool = new JedisSentinelPool("mymaster1", sentinels); // typo
// after
JedisSentinelPool pool = new JedisSentinelPool("mymaster", sentinels); // matches `sentinel monitor mymaster ...` Defensive patterns
Strategy: retry
Validate before calling
// verify before building the pool
try (Jedis s = new Jedis(sentinelHost, 26379)) {
List<String> addr = s.sentinelGetMasterAddrByName(masterName);
if (addr == null || addr.size() != 2) throw new IllegalArgumentException("unknown master: " + masterName);
} Try / catch
try { pool = new JedisSentinelPool(masterName, sentinels); } catch (JedisException e) { /* all sentinels failed: check names/connectivity */ } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
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 not get master addr, master name
- Can connect to sentinel, but
- Can connect to sentinel, but
- Cannot get master address from sentinel running @
- Master name is required for Sentinel mode
AI-assisted analysis of redis/jedis@6dac31d4c2 (2026-09-08).
Data as JSON: /api/errors/89ff08d5de2153db.
Report an issue: GitHub.
Appendix: source
Thrown at src/main/java/redis/clients/jedis/JedisSentinelPool.java:264
HostAndPort master = null;
boolean sentinelAvailable = false;
LOG.info("Trying to find master from available Sentinels...");
for (HostAndPort sentinel : sentinels) {
LOG.debug("Connecting to Sentinel {}", sentinel);
try (Jedis jedis = new Jedis(sentinel, sentinelClientConfig)) {
List<String> masterAddr = jedis.sentinelGetMasterAddrByName(masterName);
// connected to sentinel...
sentinelAvailable = true;
if (masterAddr == null || masterAddr.size() != 2) {
LOG.warn("Can not get master addr, master name: {}. Sentinel: {}", masterName, sentinel);
continue;
}
master = toHostAndPort(masterAddr);
LOG.debug("Found Redis master at {}", master);
break;
} catch (JedisException e) {
// resolves #1036, it should handle JedisException there's another chance
// of raising JedisDataException
LOG.warn(
"Cannot get master address from sentinel running @ {}. Reason: {}. Trying next one.", 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 " + masterNameView on GitHub (pinned to 6dac31d4c2)