flowable/flowable-engine · error · FlowableException

A request body was expected when bulk updating tasks.

Error message

A request body was expected when bulk updating tasks.

What it means

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.

Source

Thrown at modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/task/TaskCollectionResource.java:390

        if (restApiInterceptor != null) {
            restApiInterceptor.createTask(task, taskRequest);
        }
        
        taskService.saveTask(task);

        return restResponseFactory.createTaskResponse(task);
    }

    @ApiOperation(value = "Update Tasks", tags = { "Tasks" })
    @ApiResponses(value = {
            @ApiResponse(code = 201, message = "Indicates request was successful and the tasks are returned"),
            @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.")
    })
    @PutMapping(value = "/cmmn-runtime/tasks", produces = "application/json")
    public DataResponse<TaskResponse> bulkUpdateTasks(@RequestBody BulkTasksRequest bulkTasksRequest) {

        if (bulkTasksRequest == null) {
            throw new FlowableException("A request body was expected when bulk updating tasks.");
        }
        if (bulkTasksRequest.getTaskIds() == null) {
            throw new FlowableIllegalArgumentException("taskIds can not be null for bulk update tasks requests");
        }

        Collection<Task> taskList = getTasksFromRequest(bulkTasksRequest.getTaskIds());

        if (taskList.size() != bulkTasksRequest.getTaskIds().size()) {
            taskList.stream().forEach(task -> bulkTasksRequest.getTaskIds().remove(task.getId()));
            throw new FlowableObjectNotFoundException(
                    "Could not find task instance with id:" + bulkTasksRequest.getTaskIds().stream().collect(Collectors.joining(",")));
        }

        // Populate the task properties based on the request
        populateTasksFromRequest(taskList, bulkTasksRequest);

        if (restApiInterceptor != null) {
            restApiInterceptor.bulkUpdateTasks(taskList, bulkTasksRequest);

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Send a JSON body like {"tasks":[...], ...} with Content-Type: application/json
  2. Ensure the PUT request actually includes a non-empty body
  3. Verify the client library sends @RequestBody content instead of form params
  4. Catch FlowableException (HTTP 500/400) and re-issue the request with a valid body

Example fix

// before
curl -X PUT /cmmn-runtime/tasks
// after
curl -X PUT -H 'Content-Type: application/json' -d '{"tasks":[{"id":"t1","assignee":"kermit"}]}' /cmmn-runtime/tasks
Defensive patterns

Strategy: validation

Validate before calling

if (!body || !Object.keys(body).length) throw new Error('bulkUpdateTasks requires a JSON body');
await http.put('/cmmn-runtime/tasks', body, { headers: { 'Content-Type': 'application/json' } });

Try / catch

try { await bulkUpdate(body); } catch (e) { if (e.message.includes('A request body was expected')) { /* re-issue with a valid JSON body */ } throw e; }

Prevention

When it happens

Trigger: PUT /cmmn-runtime/tasks with no body, an empty body, or a body that resolves to null for BulkTasksRequest.

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/6500da62ff4d973e. Report an issue: GitHub.