{"record":{"id":"aa040d5fa37a96a0","repo":"redis/jedis","slug":"availability-check-for-returned-body-from","errorCode":null,"errorMessage":"Availability check for {} returned body='{}' from '{}'","messagePattern":"Availability check for (.+?) returned body='(.+?)' from '(.+?)'","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/main/java/redis/clients/jedis/mcf/RedisRestAPI.java","lineNumber":117,"sourceCode":"        availabilityUri = availabilityUri + \"&availability_lag_tolerance_ms=\"\n            + availabilityLagToleranceMs;\n      }\n    } else {\n      // Use standard datapath validation only\n      availabilityUri = String.format(AVAILABILITY_URL, endpoint.getHost(), endpoint.getPort(),\n        uid);\n    }\n\n    HttpURLConnection conn = null;\n    try {\n      conn = createConnection(availabilityUri, \"GET\", credentialsSupplier.get());\n      conn.setRequestProperty(\"Accept\", \"application/json\");\n      int code = conn.getResponseCode();\n      if (code == 200) {\n        return true;\n      }\n      String body = readResponse(conn);\n      log.warn(\"Availability check for {} returned body='{}' from '{}'\", uid, body,\n        availabilityUri);\n    } finally {\n      if (conn != null) conn.disconnect();\n    }\n    return false;\n  }\n\n  HttpURLConnection createConnection(String urlString, String method, RedisCredentials credentials)\n      throws IOException {\n    URL url = new URL(urlString);\n    HttpURLConnection connection = (HttpURLConnection) url.openConnection();\n\n    // Configure SSL if this is an HTTPS connection and SSL options are provided\n    if (connection instanceof HttpsURLConnection && sslOptions != null) {\n      HttpsURLConnection httpsConnection = (HttpsURLConnection) connection;\n      try {\n        SSLContext sslContext = sslOptions.createSslContext();\n        httpsConnection.setSSLSocketFactory(sslContext.getSocketFactory());","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/redis/jedis/blob/6dac31d4c224fb3257c216f3985340c6f500cdcb/src/main/java/redis/clients/jedis/mcf/RedisRestAPI.java#L99-L135","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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).","Verify the REST endpoint URL, port (usually 9443) and SslOptions in LagAwareStrategy.Config match your cluster.","Confirm the database still exists and its uid matches what getBdbs() returns.","If bodies show rate limiting or overload, reduce health check frequency or address cluster load."],"exampleFix":"// before\nLagAwareStrategy.Config cfg = new LagAwareStrategy.Config(restEndpoint, staleCredentialsSupplier);\n// after\nLagAwareStrategy.Config cfg = new LagAwareStrategy.Config.Builder(restEndpoint, () -> fetchFreshRestCredentials())\n    .sslOptions(validSslOptions) // correct truststore for the cluster's REST API\n    .build();","handlingStrategy":"retry","validationCode":"// Probe REST API health before starting lag-aware checks\nint code = /* GET availabilityUri */ 0;\nif (code != 200) {\n  throw new IllegalStateException(\"Redis Enterprise REST API returned HTTP \" + code +\n      \"; fix credentials/endpoint before enabling lag-aware health checks\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  boolean ok = redisRestAPI.checkBdbAvailability(bdbUid, true, lagToleranceMs);\n  if (!ok) {\n    // endpoint marked UNHEALTHY; failover proceeds — retry later with backoff\n  }\n} catch (redis.clients.jedis.exceptions.JedisException e) {\n  log.warn(\"Availability check failed\", e);\n}","preventionTips":["Keep REST API credentials fresh via a credentials supplier, not hardcoded values.","Verify REST API port (commonly 9443) and SslOptions/truststore against the cluster.","Alert on non-200 availability responses; inspect the logged body for 401/404/5xx to triage fast.","After recreating a database, update the bdb uid used by the strategy."],"tags":["rest-api","http","health-check","redis-enterprise","availability"],"backgroundTag":"http-error-response","analyzedSha":"6dac31d4c224fb3257c216f3985340c6f500cdcb","analyzedAt":"2026-09-08T04:55:01.204Z","contentChangedAt":"2026-09-08T04:55:01.204Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}