flowable/flowable-engine · error · FlowableIllegalArgumentException

tasks are null

Error message

tasks are null

What it means

BulkSaveTasksCmd.execute throws FlowableIllegalArgumentException when the taskEntities collection is null. The command iterates the list delegating each element to SaveTaskCmd; null input cannot be iterated, so it is rejected before any task is saved.

Source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/BulkSaveTasksCmd.java:36

import org.flowable.common.engine.impl.interceptor.Command;
import org.flowable.common.engine.impl.interceptor.CommandContext;
import org.flowable.task.api.Task;

/**
 * @author Christopher Welsch
 */
public class BulkSaveTasksCmd implements Command<Void> {

    protected Collection<Task> taskEntities;

    public BulkSaveTasksCmd(Collection<Task> taskList) {
        this.taskEntities = taskList;
    }

    @Override
    public Void execute(CommandContext commandContext) {
        if (taskEntities == null) {
            throw new FlowableIllegalArgumentException("tasks are null");
        }
        for (Task task : taskEntities) {
            SaveTaskCmd command = new SaveTaskCmd(task);
            command.execute(commandContext);
        }
        return null;
    }

}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Pass a non-null List<Task> (empty is acceptable) to bulkSaveTasks
  2. Initialize the task list at construction rather than leaving the field null
  3. Return early in caller code when there are no tasks to save

Example fix

// before
taskService.bulkSaveTasks(tasks);
// after
taskService.bulkSaveTasks(tasks != null ? tasks : new ArrayList<>());
Defensive patterns

Strategy: type-guard

Validate before calling

if (tasks == null) tasks = new ArrayList<>();

Type guard

boolean isNonNullList(List<Task> l) { return l != null; }

Try / catch

try {
    taskService.bulkSaveTasks(tasks);
} catch (FlowableIllegalArgumentException e) {
    log.error("Bulk save rejected: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Calling cmmnTaskService.bulkSaveTasks(null) or constructing BulkSaveTasksCmd with a null task list — often from a bulk-update endpoint whose payload collection failed to bind.

Common situations: REST clients sending no tasks array (bound as null); a build-up method returning null instead of an empty list; ORM query results assigned without initialization.

Related errors


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