flowable/flowable-engine · error · FlowableIllegalArgumentException
taskIds is null
Error message
taskIds is null
What it means
GetTasksLocalVariablesCmd.execute() bulk-fetches local variable instances for a set of task ids. It rejects a null taskIds collection with FlowableIllegalArgumentException('taskIds is null') because the query cannot be built without an id set.
Source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetTasksLocalVariablesCmd.java:45
import org.flowable.variable.service.impl.persistence.entity.VariableInstanceEntity;
/**
* @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
- Initialize taskIds to an empty Set/List instead of null before calling the bulk API.
- Null-check the collection parameter at the call site.
- Fix the upstream producer of the id collection to return an empty collection rather than null.
Example fix
// before
List<VariableInstance> vars = cmmnTaskService.getVariableInstancesLocalByTaskIds(taskIds);
// after
Set<String> ids = (taskIds != null) ? taskIds : Collections.emptySet();
if (!ids.isEmpty()) {
List<VariableInstance> vars = cmmnTaskService.getVariableInstancesLocalByTaskIds(ids);
} Defensive patterns
Strategy: validation
Validate before calling
if (taskIds == null) { throw new IllegalArgumentException("taskIds collection must be initialized"); } Type guard
boolean hasTaskIds(Collection<String> taskIds) { return taskIds != null; } Try / catch
try { return taskService.getVariableInstancesLocalByTaskIds(taskIds); } catch (FlowableIllegalArgumentException e) { return Collections.emptyList(); } Prevention
- Initialize collections eagerly (Collections.emptySet()) instead of leaving null
- Have upstream producers return empty collections, never null
- Cover bulk APIs with unit tests for null/empty inputs
When it happens
Trigger: Calling cmmnTaskService.getVariableInstancesLocalByTaskIds(null) (or the corresponding bulk task-variables API); executing a directly constructed GetTasksLocalVariablesCmd(null).
Common situations: Caller built the id set conditionally and never initialized it; upstream query returned null instead of an empty list; integration glue that forwards a nullable collection parameter.
Related errors
- Case instance id is null
- Plan item instance id is null
- taskId is null
- caseInstanceId is required
- taskId is required
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/4320ab3a2ca68b2e.
Report an issue: GitHub.