apache/seatunnel · error · DeepLakeConnectorException

REQUEST_FAILED

REQUEST_FAILED

Error message

Deep Lake request failed with HTTP ${status}${responseBody.isEmpty() ? "" : ": " + responseBody}

What it means

DeepLakeClient.post checks the HTTP status of every POST response and throws DeepLakeConnectorException(REQUEST_FAILED) when the status is outside 2xx, embedding the status code and, when present, the response body in the message. It is a generic non-2xx guard for Deep Lake HTTP API calls made by execute and executeBatch.

Source

Thrown at seatunnel-connectors-v2/connector-deeplake/src/main/java/org/apache/seatunnel/connectors/seatunnel/deeplake/client/DeepLakeClient.java:94

        post(batchQueryUrl, body);
    }

    private void post(String url, Map<String, Object> body) {
        HttpPost request = new HttpPost(url);
        request.setHeader(HttpHeaders.AUTHORIZATION, "Bearer " + config.getApiKey());
        request.setHeader(ORGANIZATION_HEADER, config.getOrgId());
        request.setHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON.getMimeType());
        request.setEntity(
                new StringEntity(JsonUtils.toJsonString(body), ContentType.APPLICATION_JSON));

        try (CloseableHttpResponse response = httpClient.execute(request)) {
            int status = response.getStatusLine().getStatusCode();
            String responseBody =
                    response.getEntity() == null
                            ? ""
                            : EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
            if (status < 200 || status >= 300) {
                throw new DeepLakeConnectorException(
                        DeepLakeConnectorErrorCode.REQUEST_FAILED,
                        "Deep Lake request failed with HTTP "
                                + status
                                + (responseBody.isEmpty() ? "" : ": " + responseBody));
            }
        } catch (IOException e) {
            throw new DeepLakeConnectorException(
                    DeepLakeConnectorErrorCode.REQUEST_FAILED, "Deep Lake request failed", e);
        }
    }

    private static String encodePathSegment(String value) {
        try {
            return URLEncoder.encode(value, StandardCharsets.UTF_8.name()).replace("+", "%20");
        } catch (Exception e) {
            throw new IllegalArgumentException("Invalid Deep Lake workspace", e);
        }
    }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Read the status code and response body in the exception message - the body usually states the server-side reason (auth, validation, capacity)
  2. Fix the request content the client sends: validate endpoint URL, payload format, and batch size for 4xx errors
  3. Verify credentials/tokens for 401/403 and refresh them in the sink/source config
  4. For 5xx/502/504, check Deep Lake service health and add retry with backoff for transient statuses

Example fix

// before
client.post(url, jsonPayload); // 500 from server, no retry
// after
try {
    client.post(url, jsonPayload);
} catch (DeepLakeConnectorException e) {
    if (isTransient(e)) retryWithBackoff(...); // handle 5xx/timeout statuses
    else throw e;
}
Defensive patterns

Strategy: retry

Validate before calling

// precheck endpoint before heavy batch writes
try (HttpResponse r = doHead(endpointUrl)) { if (r.statusCode() >= 400) throw new IllegalStateException("Deep Lake endpoint unhealthy: " + r.statusCode()); }

Try / catch

try { client.post(url, payload); } catch (DeepLakeConnectorException e) {
    int status = parseStatus(e.getMessage());
    if (status >= 500 || status == 429) retryWithBackoff();
    else if (status == 401 || status == 403) refreshCredentials();
    else throw e; // 4xx request problem: fix payload/URL
}

Prevention

When it happens

Trigger: Any Deep Lake HTTP endpoint returning 4xx/5xx: bad request payload (execute/executeBatch), authentication/authorization failure, request timeout at a gateway, server error, or rate limiting.

Common situations: Wrong endpoint/URL configured so the server 404s; expired API credentials yielding 401/403; oversized batch payloads rejected with 413; Deep Lake service outage returning 5xx; reverse proxy 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/cce013b877f44ace. Report an issue: GitHub.