{"record":{"id":"5a2d6a532f0a074e","repo":"flowable/flowable-engine","slug":"tasks-are-null","errorCode":null,"errorMessage":"tasks are null","messagePattern":"tasks are null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/BulkSaveTasksCmd.java","lineNumber":36,"sourceCode":"import org.flowable.common.engine.impl.interceptor.Command;\nimport org.flowable.common.engine.impl.interceptor.CommandContext;\nimport org.flowable.task.api.Task;\n\n/**\n * @author Christopher Welsch\n */\npublic class BulkSaveTasksCmd implements Command<Void> {\n\n    protected Collection<Task> taskEntities;\n\n    public BulkSaveTasksCmd(Collection<Task> taskList) {\n        this.taskEntities = taskList;\n    }\n\n    @Override\n    public Void execute(CommandContext commandContext) {\n        if (taskEntities == null) {\n            throw new FlowableIllegalArgumentException(\"tasks are null\");\n        }\n        for (Task task : taskEntities) {\n            SaveTaskCmd command = new SaveTaskCmd(task);\n            command.execute(commandContext);\n        }\n        return null;\n    }\n\n}\n","sourceCodeStart":18,"sourceCodeEnd":46,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/BulkSaveTasksCmd.java#L18-L46","documentation":"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.","triggerScenarios":"Calling cmmnTaskService.bulkSaveTasks(null) or constructing BulkSaveTasksCmd with a null task list — often from a bulk-update endpoint whose payload collection failed to bind.","commonSituations":"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.","solutions":["Pass a non-null List<Task> (empty is acceptable) to bulkSaveTasks","Initialize the task list at construction rather than leaving the field null","Return early in caller code when there are no tasks to save"],"exampleFix":"// before\ntaskService.bulkSaveTasks(tasks);\n// after\ntaskService.bulkSaveTasks(tasks != null ? tasks : new ArrayList<>());","handlingStrategy":"type-guard","validationCode":"if (tasks == null) tasks = new ArrayList<>();","typeGuard":"boolean isNonNullList(List<Task> l) { return l != null; }","tryCatchPattern":"try {\n    taskService.bulkSaveTasks(tasks);\n} catch (FlowableIllegalArgumentException e) {\n    log.error(\"Bulk save rejected: {}\", e.getMessage());\n}","preventionTips":["Default bulk-update payloads to an empty list when the tasks array is absent","Return Collections.emptyList() from task-building helpers","Unit-test the bulk path with empty and null inputs"],"tags":["flowable","cmmn","tasks","null-check"],"backgroundTag":"null-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"}