flowable/flowable-engine · error · FlowableIllegalArgumentException
Set of taskIds is empty
Error message
Set of taskIds is empty
What it means
After rejecting a null collection, GetTasksLocalVariablesCmd also rejects an empty one: taskIds.isEmpty() triggers FlowableIllegalArgumentException('Set of taskIds is empty'). The engine refuses to issue a query with an empty IN clause, which would be invalid or would return nothing useful.
Source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetTasksLocalVariablesCmd.java:48
* @author Tijs Rademakers
*/
public class GetTasksLocalVariablesCmd implements Command<List<VariableInstance>>, Serializable {
private static final long serialVersionUID = 1L;
protected Set<String> taskIds;
public GetTasksLocalVariablesCmd(Set<String> taskIds) {
this.taskIds = taskIds;
}
@Override
public List<VariableInstance> execute(CommandContext commandContext) {
if (taskIds == null) {
throw new FlowableIllegalArgumentException("taskIds is null");
}
if (taskIds.isEmpty()) {
throw new FlowableIllegalArgumentException("Set of taskIds is empty");
}
CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);
List<VariableInstanceEntity> entities = cmmnEngineConfiguration.getVariableServiceConfiguration()
.getVariableService().createInternalVariableInstanceQuery().taskIds(taskIds).list();
List<VariableInstance> instances = new ArrayList<>(entities.size());
for (VariableInstanceEntity entity : entities) {
entity.getValue();
instances.add(entity);
}
return instances;
}
}
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Guard with !taskIds.isEmpty() before calling the bulk API and return an empty result instead.
- Check why the upstream task query produced no ids if an empty set is unexpected.
- Skip the variable fetch entirely when the id set is empty - there is nothing to fetch.
Example fix
// before
List<VariableInstance> vars = cmmnTaskService.getVariableInstancesLocalByTaskIds(taskIds);
// after
List<VariableInstance> vars = (taskIds == null || taskIds.isEmpty())
? Collections.emptyList()
: cmmnTaskService.getVariableInstancesLocalByTaskIds(taskIds); Defensive patterns
Strategy: validation
Validate before calling
if (taskIds == null || taskIds.isEmpty()) { return Collections.emptyList(); } Type guard
boolean isFetchable(Collection<String> taskIds) { return taskIds != null && !taskIds.isEmpty(); } Try / catch
try { return taskService.getVariableInstancesLocalByTaskIds(taskIds); } catch (FlowableIllegalArgumentException e) { return Collections.emptyList(); } Prevention
- Short-circuit bulk queries when the id set is empty
- Investigate empty upstream results instead of blindly forwarding
- Wrap bulk fetches in a helper that normalizes null/empty to empty results
When it happens
Trigger: Calling the bulk local-variables API with an empty Set/Collection of task ids, e.g. after filtering out all candidate tasks.
Common situations: A preceding task query matched nothing, so the id set is empty; filters removed every id before the bulk fetch; loop where the first batch legitimately has no tasks.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- historic case instanceIds are empty
- taskIds is null
- variables is empty
- rootScopeIds is null or empty
- groupIds are empty
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/e2ec1f0d8ef98d8c.
Report an issue: GitHub.