{"record":{"id":"a9dc7d32816d7fa3","repo":"redis/jedis","slug":"unexpected-response-code-code-for-getbdbs","errorCode":null,"errorMessage":"Unexpected response code '${code}' for getBdbs: '${responseBody}' from '${bdbsUri}'","messagePattern":"Unexpected response code '(.+?)' for getBdbs: '(.+?)' from '(.+?)'","errorType":"http","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"src/main/java/redis/clients/jedis/mcf/RedisRestAPI.java","lineNumber":78,"sourceCode":"    this.endpoint = endpoint;\n    this.credentialsSupplier = credentialsSupplier;\n    this.timeoutMs = timeoutMs;\n    this.sslOptions = sslOptions;\n  }\n\n  public List<RedisRestAPI.BdbInfo> getBdbs() throws IOException {\n    if (bdbsUri == null) {\n      bdbsUri = String.format(BDBS_URL, endpoint.getHost(), endpoint.getPort());\n    }\n\n    HttpURLConnection conn = null;\n    try {\n      conn = createConnection(bdbsUri, \"GET\", credentialsSupplier.get());\n      conn.setRequestProperty(\"Accept\", \"application/json\");\n      int code = conn.getResponseCode();\n      String responseBody = readResponse(conn);\n      if (code != 200) {\n        throw new IOException(\"Unexpected response code '\" + code + \"' for getBdbs: '\"\n            + responseBody + \"' from '\" + bdbsUri + \"'\");\n      }\n      return parseBdbInfoFromResponse(responseBody);\n    } finally {\n      if (conn != null) conn.disconnect();\n    }\n  }\n\n  public boolean checkBdbAvailability(String uid, boolean lagAware) throws IOException {\n    return checkBdbAvailability(uid, lagAware, null);\n  }\n\n  public boolean checkBdbAvailability(String uid, boolean extendedCheckEnabled,\n      Long availabilityLagToleranceMs) throws IOException {\n    String availabilityUri;\n    if (extendedCheckEnabled) {\n      // Use extended check with lag validation\n      availabilityUri = String.format(LAGAWARE_AVAILABILITY_URL, endpoint.getHost(),","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/redis/jedis/blob/6dac31d4c224fb3257c216f3985340c6f500cdcb/src/main/java/redis/clients/jedis/mcf/RedisRestAPI.java#L60-L96","documentation":"RedisRestAPI.getBdbs() performs a GET against the Redis Enterprise REST API /bdbs endpoint. Any HTTP status other than 200 results in IOException \"Unexpected response code '<code>' for getBdbs: '<body>' from '<uri>'\". The message includes the status code, response body, and REST URI to ease diagnosis.","triggerScenarios":"REST API returns 401/403 (bad credentials), 404 (wrong base URL/port), 5xx (cluster issues), or a proxy error page while calling getBdbs (used by MultiDbClient's database discovery).","commonSituations":"Wrong management URI or port (not the 8070/9443 REST port); expired or wrong username/password credentials; TLS verification mismatch; cluster nodes down.","solutions":["Verify the bdbsUri points to the Redis Enterprise REST API (correct host/port and scheme)","Check credentialsSupplier returns valid REST API username/password (or API key)","Test the URI with curl -u user:pass https://host:port/v1/bdbs and inspect the returned code/body","If 401/403, fix credentials; if 5xx, check cluster health"],"exampleFix":"// before\nRedisRestAPI api = new RedisRestAPI(\"https://cluster.example.com:8080\", ...); // wrong port\n// after\nRedisRestAPI api = new RedisRestAPI(\"https://cluster.example.com:9443\", ...); // REST API port","handlingStrategy":"try-catch","validationCode":"// pre-check: HttpURLConnection c = (HttpURLConnection) new URL(bdbsUri).openConnection(); // verify reachable + credentials valid before client build","typeGuard":null,"tryCatchPattern":"try { BdbsInfo info = restApi.bdbs(); } catch (IOException e) { /* parse code/body from message; correct URI/credentials and retry */ }","preventionTips":["Verify REST URI, port, and scheme before configuring MultiDbClient","Rotate and test REST API credentials regularly","Smoke-test the /v1/bdbs endpoint with curl during deployment"],"tags":["http","rest-api","redis-enterprise","configuration"],"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"}