{"record":{"id":"6e68461160e91b45","repo":"apache/seatunnel","slug":"request-body-is-empty","errorCode":null,"errorMessage":"Request body is empty.","messagePattern":"Request body is empty\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/rest/service/BaseService.java","lineNumber":1251,"sourceCode":"                                || value instanceof BigDecimal) {\n                            if ((value instanceof Double && !Double.isFinite((Double) value))\n                                    || (value instanceof Float && !Float.isFinite((Float) value))) {\n                                strValue = value.toString();\n                            } else {\n                                strValue = new BigDecimal(value.toString()).toPlainString();\n                            }\n                        } else {\n                            strValue = value.toString();\n                        }\n                        members.add(key, strValue);\n                    }\n                });\n        return members;\n    }\n\n    protected JsonNode requestHandle(byte[] requestBody) {\n        if (requestBody.length == 0) {\n            throw new IllegalArgumentException(\"Request body is empty.\");\n        }\n        JsonNode requestBodyJsonNode;\n        try {\n            requestBodyJsonNode = RestUtil.convertByteToJsonNode(requestBody);\n        } catch (IOException e) {\n            throw new IllegalArgumentException(\"Invalid JSON format in request body.\");\n        }\n        return requestBodyJsonNode;\n    }\n\n    protected void handleStopJob(\n            Map<String, Object> map, SeaTunnelServer seaTunnelServer, Node node) {\n        boolean isStopWithSavePoint = false;\n        if (map.get(RestConstant.JOB_ID) == null) {\n            throw new IllegalArgumentException(\"jobId cannot be empty.\");\n        }\n        long jobId = Long.parseLong(map.get(RestConstant.JOB_ID).toString());\n        if (map.get(RestConstant.IS_STOP_WITH_SAVE_POINT) != null) {","sourceCodeStart":1233,"sourceCodeEnd":1269,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/rest/service/BaseService.java#L1233-L1269","documentation":"REST service endpoints that require a JSON body call BaseService.requestHandle to parse it. When the request body byte array is empty (no body sent), it throws IllegalArgumentException(\"Request body is empty.\") because these endpoints cannot act without payload fields such as jobId.","triggerScenarios":"POSTing to body-based REST endpoints (e.g. stop-job, submit-job variants) with no request body, or with Content-Length 0.","commonSituations":"curl POST without -d/--data; client forgetting to serialize the JSON payload; proxies/gateways dropping the body.","solutions":["Send a non-empty JSON body, e.g. {\"jobId\": \"123\"}","Set Content-Type: application/json and verify the client actually writes the body","Check any intermediary proxy/gateway is not stripping the request body"],"exampleFix":"// before\ncurl -X POST http://host:8080/stop-job\n// after\ncurl -X POST -H 'Content-Type: application/json' -d '{\"jobId\":\"123\"}' http://host:8080/stop-job","handlingStrategy":"validation","validationCode":"if (!body || body.length === 0) throw new Error('supply a JSON body, e.g. {\"jobId\":\"123\"}');","typeGuard":null,"tryCatchPattern":"try {\n    const res = await post(url, payload);\n} catch (e) {\n    if (String(e).includes('Request body is empty')) {\n        // re-send with a non-empty JSON body\n    }\n}","preventionTips":["Always send a JSON body on POST endpoints","Set Content-Type: application/json","Verify payload survives proxies/gateways"],"tags":["rest-api","http","validation"],"backgroundTag":"empty-request-body","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}