{"record":{"id":"cce013b877f44ace","repo":"apache/seatunnel","slug":"request-failed","errorCode":"REQUEST_FAILED","errorMessage":"Deep Lake request failed with HTTP ${status}${responseBody.isEmpty() ? \"\" : \": \" + responseBody}","messagePattern":"Deep Lake request failed with HTTP (.+?)(.+?)","errorType":"error_code","errorClass":"DeepLakeConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-deeplake/src/main/java/org/apache/seatunnel/connectors/seatunnel/deeplake/client/DeepLakeClient.java","lineNumber":94,"sourceCode":"        post(batchQueryUrl, body);\n    }\n\n    private void post(String url, Map<String, Object> body) {\n        HttpPost request = new HttpPost(url);\n        request.setHeader(HttpHeaders.AUTHORIZATION, \"Bearer \" + config.getApiKey());\n        request.setHeader(ORGANIZATION_HEADER, config.getOrgId());\n        request.setHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON.getMimeType());\n        request.setEntity(\n                new StringEntity(JsonUtils.toJsonString(body), ContentType.APPLICATION_JSON));\n\n        try (CloseableHttpResponse response = httpClient.execute(request)) {\n            int status = response.getStatusLine().getStatusCode();\n            String responseBody =\n                    response.getEntity() == null\n                            ? \"\"\n                            : EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);\n            if (status < 200 || status >= 300) {\n                throw new DeepLakeConnectorException(\n                        DeepLakeConnectorErrorCode.REQUEST_FAILED,\n                        \"Deep Lake request failed with HTTP \"\n                                + status\n                                + (responseBody.isEmpty() ? \"\" : \": \" + responseBody));\n            }\n        } catch (IOException e) {\n            throw new DeepLakeConnectorException(\n                    DeepLakeConnectorErrorCode.REQUEST_FAILED, \"Deep Lake request failed\", e);\n        }\n    }\n\n    private static String encodePathSegment(String value) {\n        try {\n            return URLEncoder.encode(value, StandardCharsets.UTF_8.name()).replace(\"+\", \"%20\");\n        } catch (Exception e) {\n            throw new IllegalArgumentException(\"Invalid Deep Lake workspace\", e);\n        }\n    }","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-deeplake/src/main/java/org/apache/seatunnel/connectors/seatunnel/deeplake/client/DeepLakeClient.java#L76-L112","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the status code and response body in the exception message - the body usually states the server-side reason (auth, validation, capacity)","Fix the request content the client sends: validate endpoint URL, payload format, and batch size for 4xx errors","Verify credentials/tokens for 401/403 and refresh them in the sink/source config","For 5xx/502/504, check Deep Lake service health and add retry with backoff for transient statuses"],"exampleFix":"// before\nclient.post(url, jsonPayload); // 500 from server, no retry\n// after\ntry {\n    client.post(url, jsonPayload);\n} catch (DeepLakeConnectorException e) {\n    if (isTransient(e)) retryWithBackoff(...); // handle 5xx/timeout statuses\n    else throw e;\n}","handlingStrategy":"retry","validationCode":"// precheck endpoint before heavy batch writes\ntry (HttpResponse r = doHead(endpointUrl)) { if (r.statusCode() >= 400) throw new IllegalStateException(\"Deep Lake endpoint unhealthy: \" + r.statusCode()); }","typeGuard":null,"tryCatchPattern":"try { client.post(url, payload); } catch (DeepLakeConnectorException e) {\n    int status = parseStatus(e.getMessage());\n    if (status >= 500 || status == 429) retryWithBackoff();\n    else if (status == 401 || status == 403) refreshCredentials();\n    else throw e; // 4xx request problem: fix payload/URL\n}","preventionTips":["Validate the endpoint URL and payload schema against the Deep Lake API before production runs","Keep batch sizes modest to avoid 413/timeout rejections","Refresh credentials on schedule to avoid 401s; monitor Deep Lake service health for 5xx spikes"],"tags":["http","deeplake","rest","api"],"backgroundTag":"http-error-response","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}