redis/jedis · error · JedisException

Can connect to sentinel, but

Error message

Can connect to sentinel, but <masterName> seems to be not monitored...

What it means

JedisSentinelPool.initSentinels() queries each configured sentinel for the current master address of masterName. If at least one sentinel was reachable (sentinelAvailable) but none returned a master entry, it concludes the master name is not monitored and throws JedisException("Can connect to sentinel, but <masterName> seems to be not monitored...").

Solutions

  1. Verify masterName with `redis-cli -p 26379 SENTINEL get-master-addr-by-name <masterName>`.
  2. Run `SENTINEL masters` on the sentinel to list monitored names and fix the client's masterName string.
  3. If monitoring is missing, add it: `SENTINEL MONITOR <name> <ip> <port> <quorum>`.
  4. Confirm the client's sentinel host/port list points at the intended sentinel deployment.

Example fix

// before
Set<String> sentinels = ...;
JedisSentinelPool pool = new JedisSentinelPool("mymaster1", sentinels); // typo
// after
JedisSentinelPool pool = new JedisSentinelPool("mymaster", sentinels); // matches SENTINEL masters output
Defensive patterns

Strategy: validation

Validate before calling

try (Jedis s = new Jedis(sentinelHost, 26379)) {
  List<String> addr = s.sentinelGetMasterAddrByName(masterName);
  if (addr == null) throw new IllegalStateException("masterName not monitored: " + masterName);
}

Try / catch

try {
  pool = new JedisSentinelPool(masterName, sentinels);
} catch (JedisException e) {
  if (e.getMessage().contains("seems to be not monitored")) {
    // fix masterName or add SENTINEL MONITOR, then retry
  } else throw e;
}

Prevention

When it happens

Trigger: Calling the JedisSentinelPool constructor with a masterName that no reachable sentinel is monitoring — SENTINEL get-master-addr-by-name returns null from every sentinel that answered.

Common situations: Typo in masterName (e.g. 'mymaster' vs 'master'); sentinels configured for a different master set than the client; sentinel monitoring was removed via SENTINEL REMOVE; pointing at the wrong sentinel port or host.

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


AI-assisted analysis of redis/jedis@6dac31d4c2 (2026-09-08). Data as JSON: /api/errors/09dcdc6a09576f24. Report an issue: GitHub.

Appendix: source

Thrown at src/main/java/redis/clients/jedis/JedisSentinelPool.java:282

          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 " + masterName
            + " seems to be not monitored...");
      } else {
        throw new JedisConnectionException("All sentinels down, cannot determine where is "
            + masterName + " master is running...");
      }
    }

    LOG.info("Redis master running at {}, starting Sentinel listeners...", master);

    for (HostAndPort sentinel : sentinels) {

      MasterListener masterListener = new MasterListener(masterName, sentinel.getHost(), sentinel.getPort());
      // whether MasterListener threads are alive or not, process can be stopped
      masterListener.setDaemon(true);
      masterListeners.add(masterListener);
      masterListener.start();
    }

View on GitHub (pinned to 6dac31d4c2)