{"record":{"id":"7762c53f45bc46a1","repo":"apache/seatunnel","slug":"bulk-response-error","errorCode":"BULK_RESPONSE_ERROR","errorMessage":"bulk ezs Response is null","messagePattern":"bulk ezs Response is null","errorType":"error_code","errorClass":"EasysearchConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-easysearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/easysearch/client/EasysearchClient.java","lineNumber":239,"sourceCode":"                                fieldName -> {\n                                    String fieldType = allEasysearchFieldTypeInfoMap.get(fieldName);\n                                    if (fieldType == null) {\n                                        log.warn(\n                                                \"fail to get easysearch field {} mapping type,so give a default type text\",\n                                                fieldName);\n                                        return \"text\";\n                                    }\n                                    return fieldType;\n                                }));\n    }\n\n    public BulkResponse bulk(String requestBody) {\n        Request request = new Request(\"POST\", \"/_bulk\");\n        request.setJsonEntity(requestBody);\n        try {\n            Response response = restClient.performRequest(request);\n            if (response == null) {\n                throw new EasysearchConnectorException(\n                        EasysearchConnectorErrorCode.BULK_RESPONSE_ERROR,\n                        \"bulk ezs Response is null\");\n            }\n            if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {\n                ObjectMapper objectMapper = new ObjectMapper();\n                String entity = EntityUtils.toString(response.getEntity());\n                JsonNode json = objectMapper.readTree(entity);\n                int took = json.get(\"took\").asInt();\n                boolean errors = json.get(\"errors\").asBoolean();\n                return new BulkResponse(errors, took, entity);\n            } else {\n                throw new EasysearchConnectorException(\n                        EasysearchConnectorErrorCode.BULK_RESPONSE_ERROR,\n                        String.format(\n                                \"bulk ezs response status code=%d,request boy=%s\",\n                                response.getStatusLine().getStatusCode(), requestBody));\n            }\n        } catch (IOException e) {","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-easysearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/easysearch/client/EasysearchClient.java#L221-L257","documentation":"EasysearchClient.bulk performs a POST /_bulk and treats a null HTTP Response as a protocol-level failure, throwing EasysearchConnectorException with BULK_RESPONSE_ERROR. A null response means the RestClient returned no usable response object for the bulk request.","triggerScenarios":"restClient.performRequest returns null while flushing buffered records through bulkResponse; typically only with misbehaving client/proxy setups or intercepted transport layers.","commonSituations":"Custom RestClient configurations or proxies swallowing the response; connection closed abnormally without raising IOException; retry middleware returning null on failure.","solutions":["Check network path/proxy between the job and Easysearch; remove any middleware that can return a null Response.","Retry the bulk write; records remain in the writer buffer only if the exception propagates before acknowledgment.","Enable RestClient trace logging to see whether a request was actually sent.","If persistent, upgrade the Easysearch REST client dependency in the connector."],"exampleFix":"// no caller fix; guard at usage site\n// before\nBulkResponse resp = client.bulk(requestBody);\n// after\ntry {\n    BulkResponse resp = client.bulk(requestBody);\n} catch (EasysearchConnectorException e) {\n    if (EasysearchConnectorErrorCode.BULK_RESPONSE_ERROR.equals(e.getErrorCode())) {\n        // retry flush or fail the sink\n    }\n    throw e;\n}","handlingStrategy":"retry","validationCode":"// ensure client and endpoint configured before bulk\nObjects.requireNonNull(restClient, \"RestClient must be initialized before bulk\");","typeGuard":null,"tryCatchPattern":"try {\n    BulkResponse resp = client.bulk(requestBody);\n} catch (EasysearchConnectorException e) {\n    if (EasysearchConnectorErrorCode.BULK_RESPONSE_ERROR.equals(e.getErrorCode())) {\n        // retry flush with backoff\n    } else throw e;\n}","preventionTips":["Avoid proxies/middleware that can drop responses","Keep RestClient configuration stock and up to date","Monitor for connection anomalies in logs"],"tags":["easysearch","bulk","null-response"],"backgroundTag":"empty-api-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"}