redis/jedis · warning

Can not get master address. Sentinel: .

Error message

Can not get master {} address. Sentinel: {}.

What it means

In the SentineledConnectionProvider's active master-refresh thread (the subscribe/refresh loop's run method), the provider polls a Sentinel for the current master address via sentinelGetMasterAddrByName. If the answer is null or does not contain exactly two elements (host and port), it logs this warning and skips the initMaster update for that cycle, then continues to the Sentinel's pub/sub subscription. It means this particular Sentinel could not report the master at that moment.

Solutions

  1. Confirm with 'SENTINEL get-master-addr-by-name <masterName>' that the Sentinel knows the master; fix the master name or 'SENTINEL monitor' config if not.
  2. Treat single occurrences as transient failover noise; only act if the warning repeats every refresh cycle.
  3. Ensure all configured Sentinels monitor the same master name and quorum is met so failovers complete quickly.
  4. Check Sentinel logs during failover to confirm it re-discovers the master and resumes answering.
  5. Verify the master still exists (not removed via SENTINEL REMOVE) in your Sentinel topology.

Example fix

// before
// sentinel added to client list but never configured to monitor the master
// after (on the Sentinel)
// SENTINEL monitor mymaster 10.0.0.5 6379 2
Defensive patterns

Strategy: retry

Validate before calling

// before enabling active refresh, confirm every configured Sentinel knows the master
sentinels.forEach(s -> {
  try (Jedis j = new Jedis(host(s), port(s))) {
    if (j.sentinelGetMasterAddrByName(masterName) == null)
      log.error("Sentinel {} does not monitor master {}", s, masterName);
  }
});

Try / catch

// the refresh loop already skips and continues on a bad answer; wrap your own failover listeners so a missed refresh triggers a re-check:
scheduler.scheduleWithFixedDelay(() -> {
  try (Jedis j = new Jedis(sentinelHost, sentinelPort)) {
    List<String> addr = j.sentinelGetMasterAddrByName(masterName);
    if (addr != null && addr.size() == 2) verifyClientMaster(addr.get(0), Integer.parseInt(addr.get(1)));
  } catch (JedisException e) { /* next cycle retries */ }
}, 0, 5, TimeUnit.SECONDS);

Prevention

When it happens

Trigger: Periodic active refresh hits a Sentinel whose sentinelGetMasterAddrByName(masterName) returns null or a list of size != 2 — e.g. the Sentinel is still doing failover discovery, the master name is unknown to that Sentinel, or the Sentinel is in a transient error state.

Common situations: Right after a failover when the Sentinel has not yet re-published the new master; one Sentinel in the pool was added later and never configured to monitor the master; transient network/timeout causing an incomplete answer; master removed on the Sentinel side while the client keeps refreshing.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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

Appendix: source

Thrown at src/main/java/redis/clients/jedis/providers/SentineledConnectionProvider.java:345

    @Override
    public void run() {

      running.set(true);

      while (running.get()) {
        try {
          // double check that it is not being shutdown
          if (!running.get()) {
            break;
          }

          sentinelJedis = sentinelConnectionFactory.createConnection(node, sentinelClientConfig);

          // code for active refresh
          List<String> masterAddr = sentinelJedis.sentinelGetMasterAddrByName(masterName);
          if (masterAddr == null || masterAddr.size() != 2) {
            LOG.warn("Can not get master {} address. Sentinel: {}.", masterName, node);
          } else {
            initMaster(toHostAndPort(masterAddr));
          }

          sentinelJedis.subscribe(new JedisPubSub() {
            @Override
            public void onSubscribe(String channel, int subscribedChannels) {
              // Successfully subscribed - reset attempt counter
              subscribeAttempt = 0;
              LOG.debug("Successfully subscribed to {} on Sentinel {}. Reset attempt counter.",
                channel, node);
            }

            @Override
            public void onMessage(String channel, String message) {
              LOG.debug("Sentinel {} published: {}.", node, message);

              String[] switchMasterMsg = message.split(" ");

View on GitHub (pinned to 6dac31d4c2)