{"record":{"id":"be992dba8b29e75a","repo":"apache/seatunnel","slug":"failed-to-execute-http-request-to-s-http-status","errorCode":null,"errorMessage":"Failed to execute HTTP request to %s , http status code is %s","messagePattern":"Failed to execute HTTP request to (.+?) , http status code is (.+?)","errorType":"exception","errorClass":"SeaTunnelException","httpStatus":null,"severity":"error","filePath":"seatunnel-api/src/main/java/org/apache/seatunnel/api/metalake/gravitino/GravitinoClient.java","lineNumber":141,"sourceCode":"        return matcher;\n    }\n\n    /**\n     * Execute HTTP GET request and return parsed JSON response. Implements retry with exponential\n     * backoff for transient failures.\n     *\n     * @param url the request URL\n     * @return parsed JSON root node\n     */\n    private JsonNode executeGetRequest(String url) {\n        for (int attempt = 1; attempt <= MAX_RETRY_ATTEMPTS; attempt++) {\n            HttpGet request = new HttpGet(url);\n            request.addHeader(HEADER_ACCEPT, MEDIA_TYPE_GRAVITINO_V1);\n            try (CloseableHttpResponse response = httpClient.execute(request)) {\n                final int statusCode = response.getStatusLine().getStatusCode();\n                if (statusCode != HttpStatus.SC_OK) {\n                    if (!isRetryableHttpStatus(statusCode)) {\n                        throw new SeaTunnelException(\n                                String.format(\n                                        \"Failed to execute HTTP request to %s , http status code is %s\",\n                                        url, statusCode));\n                    } else {\n                        sleepQuietly(RETRY_DELAY_MS);\n                    }\n                } else {\n                    HttpEntity entity = response.getEntity();\n                    if (entity == null) {\n                        throw new RuntimeException(ERROR_NO_RESPONSE_ENTITY);\n                    }\n                    try {\n                        return JsonUtils.readTree(entity.getContent());\n                    } finally {\n                        EntityUtils.consume(entity);\n                    }\n                }\n            } catch (IOException e) {","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-api/src/main/java/org/apache/seatunnel/api/metalake/gravitino/GravitinoClient.java#L123-L159","documentation":"SeaTunnelException thrown by GravitinoClient.executeGetRequest when the HTTP GET to the Gravitino URL returns a non-retryable non-200 status (anything other than 200 and the retryable 5xx/408/429 set). No retry is attempted; the request fails immediately.","triggerScenarios":"Calling any client read path (getMetaInfo/getTableSchema) when Gravitino responds 404 (wrong metalake/catalog/table), 401/403 (auth), or other 4xx; the URL exists at transport level but the resource or route is wrong.","commonSituations":"Table/catalog deleted or renamed in Gravitino; missing or wrong authentication headers; metalake name typo; reverse proxy returning 4xx for blocked routes.","solutions":["Check the status code in the message: 404 means the resource path is wrong, 401/403 means auth.","Verify the metalake/catalog/schema/table names in the URL exist in Gravitino.","Ensure authentication headers/proxy config match your Gravitino deployment.","Fix the base URI configuration so requests hit the correct Gravitino API path."],"exampleFix":"// before\nString url = \"http://host/api/metalakes/wrong/catalogs/c/schemas/s/tables/t\";\nJsonNode n = client.executeGetRequest(url);\n// after\n// verify resource exists first, then retry on transient codes only\nJsonNode n = client.executeGetRequest(correctedUrl); // 404 fixed by using correct metalake","handlingStrategy":"try-catch","validationCode":"// preflight resource existence\nHttpURLConnection c = (HttpURLConnection) new URL(tableUrl).openConnection();\nc.setRequestProperty(\"Accept\", \"application/vnd.gravitino.v1+json\");\nif (c.getResponseCode() == 404) throw new IllegalStateException(\"Resource not found: \" + tableUrl);","typeGuard":null,"tryCatchPattern":"try {\n    JsonNode node = client.executeGetRequest(url);\n} catch (SeaTunnelException e) {\n    if (e.getMessage().contains(\"http status code is 404\")) {\n        throw new IllegalStateException(\"Gravitino resource missing (check metalake/catalog/schema/table names)\", e);\n    }\n    throw e;\n}","preventionTips":["Decode the status code from the message and handle 404/401/403 distinctly.","Verify resource names exist in Gravitino before querying.","Configure authentication consistent with your Gravitino deployment.","Keep only genuinely transient codes in the retry set."],"tags":["http","gravitino","non-200","api"],"backgroundTag":"http-error-response","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}