{"record":{"id":"05d7cfe94c1f0e6b","repo":"flowable/flowable-engine","slug":"taskid-and-taskids-are-null-05d7cf","errorCode":null,"errorMessage":"taskId and taskIds are null","messagePattern":"taskId and taskIds are null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/DeleteTaskCmd.java","lineNumber":55,"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        TaskHelper.deleteTask(taskId, deleteReason, cascade);\n    }\n}\n","sourceCodeStart":37,"sourceCodeEnd":65,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/DeleteTaskCmd.java#L37-L65","documentation":"DeleteTaskCmd.deleteTask requires either a single taskId or a collection of taskIds; when both are null it throws FlowableIllegalArgumentException. Unlike the process-instance delete commands, an empty collection also reaches this branch and throws, because neither field is non-null.","triggerScenarios":"Calling taskService.deleteTask(null) / deleteTask(null, reason), deleteTasks(null), or deleteTasks(new ArrayList<>()) — an empty list also triggers this since neither argument is set.","commonSituations":"REST/HTTP handlers forwarding an absent id or an empty JSON array; delete loops where the id variable was never populated; generic cleanup utilities parameterized with optional id collections left empty.","solutions":["Pass a valid taskId, or a non-empty taskIds collection.","Guard before the call: throw a domain-specific error when both inputs are absent.","For bulk deletion from user input, validate the list is non-empty before calling deleteTasks.","Confirm you are not confusing taskId with executionId or processInstanceId."],"exampleFix":"// before\ntaskService.deleteTasks(taskIds, \"cleanup\"); // taskIds null or empty\n// after\nif (taskIds != null && !taskIds.isEmpty()) {\n    taskService.deleteTasks(taskIds, \"cleanup\");\n} else if (taskId != null) {\n    taskService.deleteTask(taskId, \"cleanup\");\n}","handlingStrategy":"validation","validationCode":"if ((taskId == null) && (taskIds == null || taskIds.isEmpty())) throw new IllegalArgumentException(\"taskId or non-empty taskIds required\");","typeGuard":null,"tryCatchPattern":"try { taskService.deleteTask(taskId, reason); } catch (FlowableIllegalArgumentException e) { log.warn(\"No task id provided\", e); }","preventionTips":["Require id fields in REST payloads via bean validation","Prefer deleteTasks with a non-empty list for bulk operations","Never call delete with both inputs unset — resolve at least one first"],"tags":["workflow","null-argument","task","validation"],"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"}