flowable/flowable-engine · error · ActivitiIllegalArgumentException

Set of executionIds is empty

Error message

Set of executionIds is empty

What it means

After the null check, GetExecutionsVariablesCmd.execute() rejects an empty executionIds set with ActivitiIllegalArgumentException('Set of executionIds is empty'). A batch variable query with no ids would return nothing meaningful and likely produces an invalid SQL IN clause, so the engine fails fast.

Solutions

  1. Guard with executionIds.isEmpty() on the caller side and return an empty result without hitting the engine.
  2. Only call the batch API when you have at least one id; fall back to the single-execution API otherwise.
  3. Investigate why the id-collection step produced an empty set (upstream query/filters).

Example fix

// before
List<VariableInstance> vars = runtimeService.getVariableInstancesByExecutionIds(ids);
// after
List<VariableInstance> vars = ids == null || ids.isEmpty()
    ? Collections.emptyList()
    : runtimeService.getVariableInstancesByExecutionIds(ids);
Defensive patterns

Strategy: validation

Validate before calling

if (executionIds == null || executionIds.isEmpty()) {
    return Collections.emptyList(); // skip the batch query entirely
}

Type guard

boolean isNonEmpty(Collection<String> c) { return c != null && !c.isEmpty(); }

Try / catch

try {
    return runtimeService.getVariableInstancesByExecutionIds(executionIds);
} catch (ActivitiIllegalArgumentException e) {
    if (e.getMessage().contains("is empty")) { return Collections.emptyList(); }
    throw e;
}

Prevention

When it happens

Trigger: Calling RuntimeService.getVariableInstancesByExecutionIds(Collections.emptySet()) or with a set that was drained/filtered to zero elements; executing the command directly with an empty collection.

Common situations: Filtering removed all candidate executions, a query for active executions returned none, or refactoring changed the population logic so nothing is added to the set.

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


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/d1d82c01bb903eac. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/GetExecutionsVariablesCmd.java:45

 * @author Daisuke Yoshimoto
 */
public class GetExecutionsVariablesCmd implements Command<List<VariableInstance>>, Serializable {

    private static final long serialVersionUID = 1L;
    protected Set<String> executionIds;

    public GetExecutionsVariablesCmd(Set<String> executionIds) {
        this.executionIds = executionIds;
    }

    @Override
    public List<VariableInstance> execute(CommandContext commandContext) {
        // Verify existence of executions
        if (executionIds == null) {
            throw new ActivitiIllegalArgumentException("executionIds is null");
        }
        if (executionIds.isEmpty()) {
            throw new ActivitiIllegalArgumentException("Set of executionIds is empty");
        }

        List<VariableInstance> instances = new ArrayList<>();
        List<VariableInstanceEntity> entities = commandContext.getVariableInstanceEntityManager().findVariableInstancesByExecutionIds(executionIds);
        for (VariableInstanceEntity entity : entities) {
            entity.getValue();
            instances.add(entity);
        }
        return instances;
    }

}

View on GitHub (pinned to d6d39ce1c6)