apache/dolphinscheduler · error · IllegalArgumentException
Http request body should be a json object, but got: %s
Error message
Http request body should be a json object, but got: %s
What it means
A body-parsing guard in getRequestBody: when the condition/body is treated as JSON, parsing produced something that is not a JSON object (array, scalar, or unparseable string), so it cannot be converted to the required Map<String,Object> request body. The offending input is the HTTP task's body/condition parameter content; the message interpolates the offending value.
Source
Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTask.java:263
.peek((httpProperty) -> {
httpProperty.setProp(ParameterUtils.convertParameterPlaceholders(httpProperty.getProp(),
ParameterUtils.convert(taskExecutionContext.getPrepareParamsMap())));
httpProperty.setValue(ParameterUtils.convertParameterPlaceholders(httpProperty.getValue(),
ParameterUtils.convert(taskExecutionContext.getPrepareParamsMap())));
})
.collect(Collectors.toMap(HttpProperty::getProp, HttpProperty::getValue));
}
private Map<String, Object> getRequestBody() {
String convertedParams = ParameterUtils.convertParameterPlaceholders(httpParameters.getHttpRequestBody(),
ParameterUtils.convert(taskExecutionContext.getPrepareParamsMap()));
JsonNode requestBodyJsonNode = JSONUtils.parseObject(convertedParams, JsonNode.class);
if (requestBodyJsonNode == null) {
return null;
}
if (!requestBodyJsonNode.isObject()) {
throw new IllegalArgumentException(String.format("Http request body should be a json object, but got: %s",
convertedParams));
}
return JSONUtils.parseObject(requestBodyJsonNode.toString(), new TypeReference<Map<String, Object>>() {
});
}
@Override
public AbstractParameters getParameters() {
return this.httpParameters;
}
public void addDefaultOutput(String response) {
// put response in output
Property outputProperty = new Property();
outputProperty.setProp(String.format("%s.%s", taskExecutionContext.getTaskName(), "response"));
outputProperty.setDirect(Direct.OUT);
outputProperty.setType(DataType.VARCHAR);View on GitHub (pinned to 02eac45a1b)
Solutions
- Make the request body a valid JSON object (curly-brace map), not an array or plain string
- Validate the body JSON in the task definition before saving
- Check placeholder substitution did not mangle the body into invalid JSON
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTask.java:263 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/7b97c7752d53c48b.
Report an issue: GitHub.