apache/seatunnel · error · DorisConnectorException

REST_SERVICE_FAILED

REST_SERVICE_FAILED

Error message

Connect to {uri}failed, status code is {statusCode}.

What it means

RestService.send throws DorisConnectorException with REST_SERVICE_FAILED when an HTTP request to the Doris FE REST endpoint (e.g. /api/{db}/{table}/_query_info used by findPartitions) returns a non-success status code. The message includes the URI and status, with the underlying exception as cause.

Source

Thrown at seatunnel-connectors-v2/connector-doris/src/main/java/org/apache/seatunnel/connectors/doris/rest/RestService.java:149

                Map map = OBJECT_MAPPER.readValue(response, Map.class);
                if (map.containsKey("code") && map.containsKey("msg")) {
                    Object data = map.get("data");
                    return OBJECT_MAPPER.writeValueAsString(data);
                } else {
                    return response;
                }
            } catch (IOException e) {
                ex = e;
                logger.warn(ErrorMessages.CONNECT_FAILED_MESSAGE, request.getURI(), e);
            }
        }
        String errMsg =
                "Connect to "
                        + request.getURI().toString()
                        + "failed, status code is "
                        + statusCode
                        + ".";
        throw new DorisConnectorException(DorisConnectorErrorCode.REST_SERVICE_FAILED, errMsg, ex);
    }

    private static String getConnectionPost(
            HttpRequestBase request, String user, String passwd, Logger logger) throws IOException {
        URL url = new URL(request.getURI().toString());
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setInstanceFollowRedirects(false);
        conn.setRequestMethod(request.getMethod());
        String authEncoding =
                Base64.getEncoder()
                        .encodeToString(
                                String.format("%s:%s", user, passwd)
                                        .getBytes(StandardCharsets.UTF_8));
        conn.setRequestProperty("Authorization", "Basic " + authEncoding);
        InputStream content = ((HttpPost) request).getEntity().getContent();
        String res = IOUtils.toString(content, StandardCharsets.UTF_8);
        conn.setDoOutput(true);
        conn.setDoInput(true);

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Open the URI from the message in a browser/curl to confirm the FE REST endpoint is reachable and the status code matches
  2. Fix the FE host and http (REST) port in the Doris sink/source config
  3. Check Doris FE process health and logs for the corresponding request error
  4. Verify the configured user/password has API access; check network/firewall between SeaTunnel and FE, then retry

Example fix

// before
url = "doris-fe-host:9020"   // query port, not REST
// after
url = "doris-fe-host:8030"   // FE http_port used by RestService
Defensive patterns

Strategy: retry

Validate before calling

// preflight the REST endpoint before the job
int code = new URL("http://" + feHost + ":" + feHttpPort + "/api/_check_connectivity").openConnection()
        .connect() instanceof HttpURLConnection ? ((HttpURLConnection) c).getResponseCode() : -1;
if (code != 200) throw new IllegalStateException("FE REST endpoint unreachable, status " + code);

Try / catch

try {
    List<PartitionDefinition> parts = RestService.findPartitions(...);
} catch (DorisConnectorException e) {
    if (e.getErrorCode() == DorisConnectorErrorCode.REST_SERVICE_FAILED) {
        LOG.error("FE REST call failed ({}); check FE host/http_port, credentials, and network, then retry", e.getMessage());
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling findPartitions (REST-based partition discovery) when the FE host/port is wrong, FE is down, a redirect to a dead node occurs, authentication fails (401/403), or the endpoint returns 404/5xx.

Common situations: Wrong http_port/REST port in config; Doris FE restarted or unreachable from the SeaTunnel worker; firewall or k8s service blocking the REST port; wrong user credentials for the REST API; BE redirect target unavailable.

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