apache/seatunnel · error · IllegalArgumentException
Request body is empty.
Error message
Request body is empty.
What it means
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.
Source
Thrown at seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/rest/service/BaseService.java:1251
|| value instanceof BigDecimal) {
if ((value instanceof Double && !Double.isFinite((Double) value))
|| (value instanceof Float && !Float.isFinite((Float) value))) {
strValue = value.toString();
} else {
strValue = new BigDecimal(value.toString()).toPlainString();
}
} else {
strValue = value.toString();
}
members.add(key, strValue);
}
});
return members;
}
protected JsonNode requestHandle(byte[] requestBody) {
if (requestBody.length == 0) {
throw new IllegalArgumentException("Request body is empty.");
}
JsonNode requestBodyJsonNode;
try {
requestBodyJsonNode = RestUtil.convertByteToJsonNode(requestBody);
} catch (IOException e) {
throw new IllegalArgumentException("Invalid JSON format in request body.");
}
return requestBodyJsonNode;
}
protected void handleStopJob(
Map<String, Object> map, SeaTunnelServer seaTunnelServer, Node node) {
boolean isStopWithSavePoint = false;
if (map.get(RestConstant.JOB_ID) == null) {
throw new IllegalArgumentException("jobId cannot be empty.");
}
long jobId = Long.parseLong(map.get(RestConstant.JOB_ID).toString());
if (map.get(RestConstant.IS_STOP_WITH_SAVE_POINT) != null) {View on GitHub (pinned to cf67b549a7)
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
Example fix
// before
curl -X POST http://host:8080/stop-job
// after
curl -X POST -H 'Content-Type: application/json' -d '{"jobId":"123"}' http://host:8080/stop-job Defensive patterns
Strategy: validation
Validate before calling
if (!body || body.length === 0) throw new Error('supply a JSON body, e.g. {"jobId":"123"}'); Try / catch
try {
const res = await post(url, payload);
} catch (e) {
if (String(e).includes('Request body is empty')) {
// re-send with a non-empty JSON body
}
} Prevention
- Always send a JSON body on POST endpoints
- Set Content-Type: application/json
- Verify payload survives proxies/gateways
When it happens
Trigger: POSTing to body-based REST endpoints (e.g. stop-job, submit-job variants) with no request body, or with Content-Length 0.
Common situations: curl POST without -d/--data; client forgetting to serialize the JSON payload; proxies/gateways dropping the body.
Related errors
- Invalid Firebase REST URI constructed. Check parameter forma
- COMMON_ILLEGAL_ARGUMENT
- Invalid JSON format in request body.
- jobId cannot be empty.
- restoreSourceJobId is required when restoreMode=${restoreMod
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/6e68461160e91b45.
Report an issue: GitHub.