apache/seatunnel · error · HttpConnectorException

REQUEST_FAILED

REQUEST_FAILED

Error message

http client execute exception, http response status code:[${code}], content:[${content}]

What it means

GraphQLSourceHttpReader.pollAndCollectData executes the GraphQL HTTP request via an HTTP client; when the response status code is not successful it throws HttpConnectorException(REQUEST_FAILED) including the status code and response body. It means the server answered but rejected or failed the request.

Source

Thrown at seatunnel-connectors-v2/connector-graphql/src/main/java/org/apache/seatunnel/connectors/seatunnel/graphql/source/reader/GraphQLSourceHttpReader.java:138

                    String lineStr;
                    while ((lineStr = bufferedReader.readLine()) != null) {
                        GraphQLUtil.collect(deserializationCollector, lineStr, contentJson, output);
                    }
                } else {
                    GraphQLUtil.collect(deserializationCollector, content, contentJson, output);
                }
            }
            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);
        }
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Read the status code and content in the message to identify the failure
  2. 400: validate the query and variables against the schema (GraphiQL/Introspection)
  3. 401/403: fix the auth header/token configuration
  4. 429: reduce parallelism or add rate limiting/backoff
  5. 5xx/502/504: retry later or check the GraphQL server's own logs

Example fix

// before: query variable type mismatch
query($id: Int!) { user(id: $id) { name } }  // server sends string
// after
query($id: String!) { user(id: $id) { name } }
Defensive patterns

Strategy: try-catch

Validate before calling

// validate query against schema before running the job
curl -X POST $URL -H 'Authorization: ...' -d '{"query":"...","variables":{}}'

Try / catch

try { pollAndCollectData(); } catch (HttpConnectorException e) { switch (e.getStatusCode() / parse from msg) { case 429: backoff; case 401: refresh token; default: fail task; } }

Prevention

When it happens

Trigger: HTTP client returns a non-2xx code (400 bad query, 401/403 auth, 404 wrong endpoint, 429 rate limit, 5xx server error) during internalPollNext's polling loop.

Common situations: Malformed GraphQL query/variables; expired or missing auth header; wrong URL path; GraphQL server returning 500 on resolver errors; gateway returning 502/504.

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