flowable/flowable-engine · error · FlowableIllegalArgumentException

Set of called process instance ids is empty

Error message

Set of called process instance ids is empty

What it means

HistoricActivityInstanceQueryImpl.calledProcessInstanceIds(Set<String>) rejects an empty set with FlowableIllegalArgumentException. An empty id set cannot form a valid SQL IN clause, so Flowable validates it eagerly at query construction.

Source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/HistoricActivityInstanceQueryImpl.java:166

    @Override
    public HistoricActivityInstanceQueryImpl finishedBefore(Date date) {
        this.finishedBefore = date;
        return this;
    }

    @Override
    public HistoricActivityInstanceQuery activityTypes(Set<String> activityTypes) {
        this.activityTypes=activityTypes;
        return this;
    }

    @Override
    public HistoricActivityInstanceQuery calledProcessInstanceIds(Set<String> calledProcessInstanceIds) {
        if (calledProcessInstanceIds == null) {
            throw new FlowableIllegalArgumentException("Set of called process instance ids is null");
        }
        if (calledProcessInstanceIds.isEmpty()) {
            throw new FlowableIllegalArgumentException("Set of called process instance ids is empty");
        }
        this.calledProcessInstanceIds = calledProcessInstanceIds;
        return this;
    }

    @Override
    public HistoricActivityInstanceQueryImpl taskAssignee(String assignee) {
        this.assignee = assignee;
        return this;
    }

    @Override
    public HistoricActivityInstanceQuery taskCompletedBy(String userId) {
        this.completedBy = userId;
        return this;
    }

    @Override

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Check isEmpty() before applying the filter; skip it or return an empty result early
  2. Collect sub-process ids with a fallback default of Collections.emptySet() and branch on emptiness
  3. If the analysis is meaningless with no sub-processes, avoid the query and communicate 'no data' to the caller

Example fix

// before
query.calledProcessInstanceIds(collectCalledIds());

// after
Set<String> calledIds = collectCalledIds();
if (!calledIds.isEmpty()) {
    query.calledProcessInstanceIds(calledIds);
} else {
    return Collections.emptyList();
}
Defensive patterns

Strategy: validation

Validate before calling

if (calledIds != null && !calledIds.isEmpty()) {
    query.calledProcessInstanceIds(calledIds);
} else {
    return Collections.emptyList();
}

Type guard

boolean isNonEmptySet(Set<String> s) { return s != null && !s.isEmpty(); }

Try / catch

try {
    query.calledProcessInstanceIds(calledIds);
} catch (FlowableIllegalArgumentException e) {
    if (!e.getMessage().contains("called process instance ids is empty")) throw e;
    // treat as no data
}

Prevention

When it happens

Trigger: Calling calledProcessInstanceIds with an empty HashSet, or with a set whose elements were all removed/filtered out before building the query.

Common situations: Call-activity analysis where no sub-process instances exist yet; filters narrowed to zero matches by user selections.

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/6dbe2bead1b52ae6. Report an issue: GitHub.