{"record":{"id":"7b97c7752d53c48b","repo":"apache/dolphinscheduler","slug":"http-request-body-should-be-a-json-object-but-got","errorCode":null,"errorMessage":"Http request body should be a json object, but got: %s","messagePattern":"Http request body should be a json object, but got: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTask.java","lineNumber":263,"sourceCode":"                .peek((httpProperty) -> {\n                    httpProperty.setProp(ParameterUtils.convertParameterPlaceholders(httpProperty.getProp(),\n                            ParameterUtils.convert(taskExecutionContext.getPrepareParamsMap())));\n                    httpProperty.setValue(ParameterUtils.convertParameterPlaceholders(httpProperty.getValue(),\n                            ParameterUtils.convert(taskExecutionContext.getPrepareParamsMap())));\n                })\n                .collect(Collectors.toMap(HttpProperty::getProp, HttpProperty::getValue));\n    }\n\n    private Map<String, Object> getRequestBody() {\n        String convertedParams = ParameterUtils.convertParameterPlaceholders(httpParameters.getHttpRequestBody(),\n                ParameterUtils.convert(taskExecutionContext.getPrepareParamsMap()));\n        JsonNode requestBodyJsonNode = JSONUtils.parseObject(convertedParams, JsonNode.class);\n        if (requestBodyJsonNode == null) {\n            return null;\n        }\n\n        if (!requestBodyJsonNode.isObject()) {\n            throw new IllegalArgumentException(String.format(\"Http request body should be a json object, but got: %s\",\n                    convertedParams));\n        }\n\n        return JSONUtils.parseObject(requestBodyJsonNode.toString(), new TypeReference<Map<String, Object>>() {\n        });\n    }\n\n    @Override\n    public AbstractParameters getParameters() {\n        return this.httpParameters;\n    }\n\n    public void addDefaultOutput(String response) {\n        // put response in output\n        Property outputProperty = new Property();\n        outputProperty.setProp(String.format(\"%s.%s\", taskExecutionContext.getTaskName(), \"response\"));\n        outputProperty.setDirect(Direct.OUT);\n        outputProperty.setType(DataType.VARCHAR);","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/main/java/org/apache/dolphinscheduler/plugin/task/http/HttpTask.java#L245-L281","documentation":"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.","triggerScenarios":"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.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}