{"record":{"id":"fdba89943e53bf41","repo":"flowable/flowable-engine","slug":"taskid-and-taskids-are-null","errorCode":null,"errorMessage":"taskId and taskIds are null","messagePattern":"taskId and taskIds are null","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/DeleteTaskCmd.java","lineNumber":58,"sourceCode":"        this.deleteReason = deleteReason;\n    }\n\n    public DeleteTaskCmd(Collection<String> taskIds, String deleteReason, boolean cascade) {\n        this.taskIds = taskIds;\n        this.cascade = cascade;\n        this.deleteReason = deleteReason;\n    }\n\n    @Override\n    public Void execute(CommandContext commandContext) {\n        if (taskId != null) {\n            deleteTask(commandContext, taskId);\n        } else if (taskIds != null) {\n            for (String taskId : taskIds) {\n                deleteTask(commandContext, taskId);\n            }\n        } else {\n            throw new FlowableIllegalArgumentException(\"taskId and taskIds are null\");\n        }\n\n        return null;\n    }\n\n    protected void deleteTask(CommandContext commandContext, String taskId) {\n        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);\n        TaskHelper.deleteTask(taskId, deleteReason, cascade, cmmnEngineConfiguration);\n    }\n}\n","sourceCodeStart":40,"sourceCodeEnd":69,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/DeleteTaskCmd.java#L40-L69","documentation":"FlowableIllegalArgumentException thrown by DeleteTaskCmd.execute when neither taskId nor taskIds was supplied. The command needs at least one task identifier to know which task(s) to delete. It is a null/empty argument guard at the start of execution.","triggerScenarios":"Calling taskService.deleteTask(null) or a batch delete API where both the single taskId and the taskIds collection are null/empty.","commonSituations":"Batch job where the id list came from an empty DB query; optional taskId variable never set; passing an empty List instead of null and neither field was populated.","solutions":["Check taskId != null || (taskIds != null && !taskIds.isEmpty()) before calling deleteTask","Populate taskIds from a validated source and fail early in the caller","If no ids is a legitimate case, skip the call rather than invoking it"],"exampleFix":"// before\ntaskService.deleteTask(taskId, taskIds);\n// after\nif (taskId != null) {\n    taskService.deleteTask(taskId);\n} else if (taskIds != null && !taskIds.isEmpty()) {\n    for (String id : taskIds) taskService.deleteTask(id);\n}","handlingStrategy":"validation","validationCode":"if (taskId == null && (taskIds == null || taskIds.isEmpty())) throw new IllegalArgumentException(\"taskId or taskIds required\");","typeGuard":"boolean hasTarget = taskId != null || (taskIds != null && !taskIds.isEmpty());","tryCatchPattern":null,"preventionTips":["Never call delete with no resolved ids; short-circuit empty batches","Validate id sources (queries, params) before invoking engine commands"],"tags":["cmmn","task","null-argument","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"}