{"record":{"id":"6500da62ff4d973e","repo":"flowable/flowable-engine","slug":"a-request-body-was-expected-when-bulk-updating-tas","errorCode":null,"errorMessage":"A request body was expected when bulk updating tasks.","messagePattern":"A request body was expected when bulk updating tasks\\.","errorType":"http","errorClass":"FlowableException","httpStatus":500,"severity":"error","filePath":"modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/task/TaskCollectionResource.java","lineNumber":390,"sourceCode":"        if (restApiInterceptor != null) {\n            restApiInterceptor.createTask(task, taskRequest);\n        }\n        \n        taskService.saveTask(task);\n\n        return restResponseFactory.createTaskResponse(task);\n    }\n\n    @ApiOperation(value = \"Update Tasks\", tags = { \"Tasks\" })\n    @ApiResponses(value = {\n            @ApiResponse(code = 201, message = \"Indicates request was successful and the tasks are returned\"),\n            @ApiResponse(code = 400, message = \"Indicates a parameter was passed in the wrong format or that delegationState has an invalid value (other than pending and resolved). The status-message contains additional information.\")\n    })\n    @PutMapping(value = \"/cmmn-runtime/tasks\", produces = \"application/json\")\n    public DataResponse<TaskResponse> bulkUpdateTasks(@RequestBody BulkTasksRequest bulkTasksRequest) {\n\n        if (bulkTasksRequest == null) {\n            throw new FlowableException(\"A request body was expected when bulk updating tasks.\");\n        }\n        if (bulkTasksRequest.getTaskIds() == null) {\n            throw new FlowableIllegalArgumentException(\"taskIds can not be null for bulk update tasks requests\");\n        }\n\n        Collection<Task> taskList = getTasksFromRequest(bulkTasksRequest.getTaskIds());\n\n        if (taskList.size() != bulkTasksRequest.getTaskIds().size()) {\n            taskList.stream().forEach(task -> bulkTasksRequest.getTaskIds().remove(task.getId()));\n            throw new FlowableObjectNotFoundException(\n                    \"Could not find task instance with id:\" + bulkTasksRequest.getTaskIds().stream().collect(Collectors.joining(\",\")));\n        }\n\n        // Populate the task properties based on the request\n        populateTasksFromRequest(taskList, bulkTasksRequest);\n\n        if (restApiInterceptor != null) {\n            restApiInterceptor.bulkUpdateTasks(taskList, bulkTasksRequest);","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/task/TaskCollectionResource.java#L372-L408","documentation":"bulkUpdateTasks (PUT /cmmn-runtime/tasks) requires a JSON request body of type BulkTasksRequest. When the body is missing or null, the method throws a plain FlowableException stating a request body was expected. Note @RequestBody would normally reject a truly absent body, so this guards against a body that deserializes to null.","triggerScenarios":"PUT /cmmn-runtime/tasks with no body, an empty body, or a body that resolves to null for BulkTasksRequest.","commonSituations":"Clients forgetting Content-Type: application/json so the body is not bound; empty PUT requests from scripts; proxies stripping bodies; sending body fields not matching BulkTasksRequest.","solutions":["Send a JSON body like {\"tasks\":[...], ...} with Content-Type: application/json","Ensure the PUT request actually includes a non-empty body","Verify the client library sends @RequestBody content instead of form params","Catch FlowableException (HTTP 500/400) and re-issue the request with a valid body"],"exampleFix":"// before\ncurl -X PUT /cmmn-runtime/tasks\n// after\ncurl -X PUT -H 'Content-Type: application/json' -d '{\"tasks\":[{\"id\":\"t1\",\"assignee\":\"kermit\"}]}' /cmmn-runtime/tasks","handlingStrategy":"validation","validationCode":"if (!body || !Object.keys(body).length) throw new Error('bulkUpdateTasks requires a JSON body');\nawait http.put('/cmmn-runtime/tasks', body, { headers: { 'Content-Type': 'application/json' } });","typeGuard":null,"tryCatchPattern":"try { await bulkUpdate(body); } catch (e) { if (e.message.includes('A request body was expected')) { /* re-issue with a valid JSON body */ } throw e; }","preventionTips":["Always set Content-Type: application/json on PUT requests","Assert the body is serialized before sending","Log outgoing request bodies for bulk operations"],"tags":["rest","http","request-body","validation"],"backgroundTag":"missing-required-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}