apache/seatunnel · warning

Request failed with code:{}

Error message

Request failed with code:{}

What it means

HttpHelper.getHttpEntity inspects the HTTP status of a StarRocks response; when the status code is not 200 it logs this warning and returns null. The caller is expected to treat null as a failed request. It is a warning log rather than an exception — the failure surfaces when the caller dereferences null or reports failure.

Source

Thrown at seatunnel-connectors-v2/connector-starrocks/src/main/java/org/apache/seatunnel/connectors/seatunnel/starrocks/client/HttpHelper.java:62

import java.util.HashMap;
import java.util.Map;

@Slf4j
public class HttpHelper {
    private static final int DEFAULT_CONNECT_TIMEOUT = 1000000;

    private SinkConfig sinkConfig;

    public HttpHelper() {}

    public HttpHelper(SinkConfig sinkConfig) {
        this.sinkConfig = sinkConfig;
    }

    public HttpEntity getHttpEntity(CloseableHttpResponse resp) {
        int code = resp.getStatusLine().getStatusCode();
        if (HttpStatus.SC_OK != code) {
            log.warn("Request failed with code:{}", code);
            return null;
        }
        HttpEntity respEntity = resp.getEntity();
        if (null == respEntity) {
            log.warn("Request failed with empty response.");
            return null;
        }
        return respEntity;
    }

    public String doHttpPost(String postUrl, Map<String, String> header, String postBody)
            throws IOException {
        log.info("Executing POST from {}.", postUrl);
        try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
            HttpPost httpPost = new HttpPost(postUrl);
            if (null != header) {
                for (Map.Entry<String, String> entry : header.entrySet()) {
                    httpPost.setHeader(entry.getKey(), String.valueOf(entry.getValue()));

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Log/inspect the actual status code to identify 4xx vs 5xx
  2. Fix the StarRocks endpoint URL, credentials, or database/table names
  3. Check StarRocks server health and FE/BE availability
  4. Add retry logic for transient 5xx responses

Example fix

// before
HttpEntity entity = httpHelper.getHttpEntity(resp);
if (entity == null) { /* silent failure */ }
// after
HttpEntity entity = httpHelper.getHttpEntity(resp);
if (entity == null) {
    int code = resp.getStatusLine().getStatusCode();
    throw new IOException("StarRocks request failed, HTTP code=" + code);
}
Defensive patterns

Strategy: type-guard

Validate before calling

// Pre-flight check of the StarRocks endpoint
int status = probeHttpStatus(starRocksUrl, credentials);
if (status != 200) throw new IllegalStateException("StarRocks endpoint returned " + status);

Type guard

HttpEntity entity = httpHelper.getHttpEntity(resp);
if (entity == null) { // treat as failure
    throw new IOException("StarRocks request failed (non-200 or empty body)");
}

Prevention

When it happens

Trigger: Any HTTP request through HttpHelper that receives a non-200 status code, e.g. StarRocks returning 404 (wrong table/db), 401/407 (auth/proxy), 500 (server-side error), or load balancer errors.

Common situations: Misconfigured StarRocks FE/BE host or port; wrong database/table name; missing basic-auth credentials; proxy returning 407; StarRocks overloaded returning 5xx.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/d8e02ce960d84d20. Report an issue: GitHub.