apache/seatunnel · error · HttpConnectorException

REQUEST_FAILED

REQUEST_FAILED

Error message

http client execute exception, http response status code:[%s], content:[%s]

What it means

In HttpSourceReader.pollAndCollectData, when the HTTP client returns a response whose status code is not in the accepted success range, the reader throws REQUEST_FAILED with the status code and response body. This is the standard text-mode failure path for HTTP requests during polling.

Source

Thrown at seatunnel-connectors-v2/connector-http/connector-http-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/http/source/HttpSourceReader.java:190

                    String lineStr;
                    while ((lineStr = bufferedReader.readLine()) != null) {
                        collect(output, lineStr);
                    }
                } else {
                    collect(output, content);
                }
            }
            log.debug(
                    "http client execute success request param:[{}], http response status code:[{}], content:[{}]",
                    httpParameter.getParams(),
                    response.getCode(),
                    response.getContent());
        } else {
            String msg =
                    String.format(
                            "http client execute exception, http response status code:[%s], content:[%s]",
                            response.getCode(), response.getContent());
            throw new HttpConnectorException(HttpConnectorErrorCode.REQUEST_FAILED, msg);
        }
    }

    private void pollAndCollectBinaryData(Collector<SeaTunnelRow> output) throws Exception {
        int statusCode =
                httpClient.executeBinaryStreaming(
                        this.httpParameter.getUrl(),
                        this.httpParameter.getMethod().getMethod(),
                        this.httpParameter.getHeaders(),
                        this.httpParameter.getParams(),
                        this.httpParameter.getBody(),
                        this.httpParameter.isKeepParamsAsForm(),
                        binaryChunkSize,
                        httpParameter.getUrl(),
                        row -> output.collect(new SeaTunnelRow(row)));
        if (statusCode >= 200 && statusCode <= 207) {
            noMoreElementFlag = true;
        } else {

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Check the status code and content in the error message to identify whether it is auth (401/403), routing (404), rate limit (429), or server error (5xx)
  2. Fix the URL, credentials, and headers in the HTTP source config
  3. Add retry configuration or verify server availability if 5xx
  4. Verify network/proxy connectivity from the SeaTunnel worker nodes

Example fix

// before
url = "http://api.example.com/v2/data"  # 404 after API version bump
// after
url = "http://api.example.com/v3/data"
Defensive patterns

Strategy: try-catch

Validate before calling

// probe endpoint before job: curl -s -o /dev/null -w '%{http_code}' $URL -H 'Authorization: ...'

Try / catch

try { reader.pollAndCollectData(collector); } catch (HttpConnectorException e) { if (e.getErrorCode() == HttpConnectorErrorCode.REQUEST_FAILED) { log.error("HTTP request failed; check status code in message", e); throw e; } throw e; }

Prevention

When it happens

Trigger: pollAndCollectData executes an HTTP request whose response code is outside 200-207 (e.g. 404, 500, 401, 429).

Common situations: Wrong URL or path returning 404; expired/missing auth headers returning 401/403; server-side 5xx errors; rate limiting (429); proxy/gateway failures returning 502/503.

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/13c22e86f0e77036. Report an issue: GitHub.