redis/jedis · warning

Availability check for

Error message

Availability check for {} returned body='{}' from '{}'

What it means

RedisRestAPI.checkBdbAvailability logs this warning when the Redis Enterprise REST availability check for a BDB uid returns a non-200 HTTP status, and it includes the response body and the availability URI used. The method then returns false, which makes LagAwareStrategy report the endpoint as UNHEALTHY and can trigger failover. The message is diagnostic; it tells you exactly what the REST API said and from which URL.

Solutions

  1. Read the logged body/URI to identify the HTTP status; fix the specific cause (401 => refresh REST API credentials; 404 => correct bdb uid; 5xx => check cluster health).
  2. Verify the REST endpoint URL, port (usually 9443) and SslOptions in LagAwareStrategy.Config match your cluster.
  3. Confirm the database still exists and its uid matches what getBdbs() returns.
  4. If bodies show rate limiting or overload, reduce health check frequency or address cluster load.

Example fix

// before
LagAwareStrategy.Config cfg = new LagAwareStrategy.Config(restEndpoint, staleCredentialsSupplier);
// after
LagAwareStrategy.Config cfg = new LagAwareStrategy.Config.Builder(restEndpoint, () -> fetchFreshRestCredentials())
    .sslOptions(validSslOptions) // correct truststore for the cluster's REST API
    .build();
Defensive patterns

Strategy: retry

Validate before calling

// Probe REST API health before starting lag-aware checks
int code = /* GET availabilityUri */ 0;
if (code != 200) {
  throw new IllegalStateException("Redis Enterprise REST API returned HTTP " + code +
      "; fix credentials/endpoint before enabling lag-aware health checks");
}

Try / catch

try {
  boolean ok = redisRestAPI.checkBdbAvailability(bdbUid, true, lagToleranceMs);
  if (!ok) {
    // endpoint marked UNHEALTHY; failover proceeds — retry later with backoff
  }
} catch (redis.clients.jedis.exceptions.JedisException e) {
  log.warn("Availability check failed", e);
}

Prevention

When it happens

Trigger: checkBdbAvailability(bdb, extendedCheck[, lagTolerance]) performs an HTTP GET to the cluster's availability endpoint; the response code is not 200 (e.g. 401 unauthorized, 404 unknown bdb uid, 5xx cluster error), so the body is read and logged before returning false.

Common situations: Expired/wrong REST API credentials so the API returns 401; bdb uid stale after the database was recreated (404); cluster overloaded returning 5xx; wrong REST port/TLS configuration hitting an unexpected service.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


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

Appendix: source

Thrown at src/main/java/redis/clients/jedis/mcf/RedisRestAPI.java:117

        availabilityUri = availabilityUri + "&availability_lag_tolerance_ms="
            + availabilityLagToleranceMs;
      }
    } else {
      // Use standard datapath validation only
      availabilityUri = String.format(AVAILABILITY_URL, endpoint.getHost(), endpoint.getPort(),
        uid);
    }

    HttpURLConnection conn = null;
    try {
      conn = createConnection(availabilityUri, "GET", credentialsSupplier.get());
      conn.setRequestProperty("Accept", "application/json");
      int code = conn.getResponseCode();
      if (code == 200) {
        return true;
      }
      String body = readResponse(conn);
      log.warn("Availability check for {} returned body='{}' from '{}'", uid, body,
        availabilityUri);
    } finally {
      if (conn != null) conn.disconnect();
    }
    return false;
  }

  HttpURLConnection createConnection(String urlString, String method, RedisCredentials credentials)
      throws IOException {
    URL url = new URL(urlString);
    HttpURLConnection connection = (HttpURLConnection) url.openConnection();

    // Configure SSL if this is an HTTPS connection and SSL options are provided
    if (connection instanceof HttpsURLConnection && sslOptions != null) {
      HttpsURLConnection httpsConnection = (HttpsURLConnection) connection;
      try {
        SSLContext sslContext = sslOptions.createSslContext();
        httpsConnection.setSSLSocketFactory(sslContext.getSocketFactory());

View on GitHub (pinned to 6dac31d4c2)