apache/seatunnel · error · SeaTunnelException

Failed to execute HTTP request to %s , http status code is %

Error message

Failed to execute HTTP request to %s , http status code is %s

What it means

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.

Source

Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/metalake/gravitino/GravitinoClient.java:141

        return matcher;
    }

    /**
     * Execute HTTP GET request and return parsed JSON response. Implements retry with exponential
     * backoff for transient failures.
     *
     * @param url the request URL
     * @return parsed JSON root node
     */
    private JsonNode executeGetRequest(String url) {
        for (int attempt = 1; attempt <= MAX_RETRY_ATTEMPTS; attempt++) {
            HttpGet request = new HttpGet(url);
            request.addHeader(HEADER_ACCEPT, MEDIA_TYPE_GRAVITINO_V1);
            try (CloseableHttpResponse response = httpClient.execute(request)) {
                final int statusCode = response.getStatusLine().getStatusCode();
                if (statusCode != HttpStatus.SC_OK) {
                    if (!isRetryableHttpStatus(statusCode)) {
                        throw new SeaTunnelException(
                                String.format(
                                        "Failed to execute HTTP request to %s , http status code is %s",
                                        url, statusCode));
                    } else {
                        sleepQuietly(RETRY_DELAY_MS);
                    }
                } else {
                    HttpEntity entity = response.getEntity();
                    if (entity == null) {
                        throw new RuntimeException(ERROR_NO_RESPONSE_ENTITY);
                    }
                    try {
                        return JsonUtils.readTree(entity.getContent());
                    } finally {
                        EntityUtils.consume(entity);
                    }
                }
            } catch (IOException e) {

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Check the status code in the message: 404 means the resource path is wrong, 401/403 means auth.
  2. Verify the metalake/catalog/schema/table names in the URL exist in Gravitino.
  3. Ensure authentication headers/proxy config match your Gravitino deployment.
  4. Fix the base URI configuration so requests hit the correct Gravitino API path.

Example fix

// before
String url = "http://host/api/metalakes/wrong/catalogs/c/schemas/s/tables/t";
JsonNode n = client.executeGetRequest(url);
// after
// verify resource exists first, then retry on transient codes only
JsonNode n = client.executeGetRequest(correctedUrl); // 404 fixed by using correct metalake
Defensive patterns

Strategy: try-catch

Validate before calling

// preflight resource existence
HttpURLConnection c = (HttpURLConnection) new URL(tableUrl).openConnection();
c.setRequestProperty("Accept", "application/vnd.gravitino.v1+json");
if (c.getResponseCode() == 404) throw new IllegalStateException("Resource not found: " + tableUrl);

Try / catch

try {
    JsonNode node = client.executeGetRequest(url);
} catch (SeaTunnelException e) {
    if (e.getMessage().contains("http status code is 404")) {
        throw new IllegalStateException("Gravitino resource missing (check metalake/catalog/schema/table names)", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: Table/catalog deleted or renamed in Gravitino; missing or wrong authentication headers; metalake name typo; reverse proxy returning 4xx for blocked routes.

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 apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/be992dba8b29e75a. Report an issue: GitHub.