flowable/flowable-engine · error · FlowableIllegalArgumentException
taskId and taskIds are null
Error message
taskId and taskIds are null
What it means
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.
Source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/DeleteTaskCmd.java:58
this.deleteReason = deleteReason;
}
public DeleteTaskCmd(Collection<String> taskIds, String deleteReason, boolean cascade) {
this.taskIds = taskIds;
this.cascade = cascade;
this.deleteReason = deleteReason;
}
@Override
public Void execute(CommandContext commandContext) {
if (taskId != null) {
deleteTask(commandContext, taskId);
} else if (taskIds != null) {
for (String taskId : taskIds) {
deleteTask(commandContext, taskId);
}
} else {
throw new FlowableIllegalArgumentException("taskId and taskIds are null");
}
return null;
}
protected void deleteTask(CommandContext commandContext, String taskId) {
CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);
TaskHelper.deleteTask(taskId, deleteReason, cascade, cmmnEngineConfiguration);
}
}
View on GitHub (pinned to d6d39ce1c6)
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
Example fix
// before
taskService.deleteTask(taskId, taskIds);
// after
if (taskId != null) {
taskService.deleteTask(taskId);
} else if (taskIds != null && !taskIds.isEmpty()) {
for (String id : taskIds) taskService.deleteTask(id);
} Defensive patterns
Strategy: validation
Validate before calling
if (taskId == null && (taskIds == null || taskIds.isEmpty())) throw new IllegalArgumentException("taskId or taskIds required"); Type guard
boolean hasTarget = taskId != null || (taskIds != null && !taskIds.isEmpty());
Prevention
- Never call delete with no resolved ids; short-circuit empty batches
- Validate id sources (queries, params) before invoking engine commands
When it happens
Trigger: Calling taskService.deleteTask(null) or a batch delete API where both the single taskId and the taskIds collection are null/empty.
Common situations: 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.
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
- taskId is null
- Must specify a case instance id to migrate
- Must specify a case instance migration document to migrate
- Must specify a case definition id to migrate
- Null task id
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/fdba89943e53bf41.
Report an issue: GitHub.