flowable/flowable-engine · error · ActivitiIllegalArgumentException

None of the given task assignees can be null

Error message

None of the given task assignees can be null

What it means

Thrown by TaskQueryImpl.taskAssigneeIds(List<String>) when one of the entries in the assigneeIds list is null. Each element becomes part of an IN-clause; a null element is not a valid assignee id, so the loop validates every entry and fails fast with ActivitiIllegalArgumentException.

Solutions

  1. Filter nulls before the call: ids.removeIf(Objects::isNull) or stream().filter(Objects::nonNull).
  2. Validate each id in the service layer and fail with a precise message naming the offending entry.
  3. Fix the upstream lookup so unknown users are skipped instead of yielding null.
  4. After filtering, re-check emptiness (the empty-list check will otherwise fire next).

Example fix

// before
List<String> ids = users.stream().map(User::getId).collect(toList()); // may contain nulls
query.taskAssigneeIds(ids);

// after
List<String> ids = users.stream()
    .map(User::getId)
    .filter(Objects::nonNull)
    .collect(toList());
if (!ids.isEmpty()) {
    query.taskAssigneeIds(ids);
}
Defensive patterns

Strategy: validation

Validate before calling

List<String> cleanIds = assigneeIds == null ? Collections.emptyList()
    : assigneeIds.stream().filter(Objects::nonNull).collect(Collectors.toList());
if (!cleanIds.isEmpty()) {
    query.taskAssigneeIds(cleanIds);
}

Type guard

List<String> withoutNulls(List<String> l) { return l == null ? Collections.emptyList() : l.stream().filter(Objects::nonNull).collect(Collectors.toList()); }

Try / catch

try {
    query.taskAssigneeIds(assigneeIds);
} catch (ActivitiIllegalArgumentException e) {
    throw new BadRequestException("Null assignee id in list");
}

Prevention

When it happens

Trigger: Calling taskQuery.taskAssigneeIds(Arrays.asList("kermit", null)) or passing a collection built from a lookup that produced null entries for unknown users.

Common situations: Building the id list from a map where some keys mapped to null; deserializing a JSON array containing nulls; collecting resolved user objects and forgetting to filter unresolved ones.

Related errors


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

Appendix: source

Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java:385

        if (orActive) {
            currentOrQueryObject.assigneeLikeIgnoreCase = assigneeLikeIgnoreCase.toLowerCase();
        } else {
            this.assigneeLikeIgnoreCase = assigneeLikeIgnoreCase.toLowerCase();
        }
        return this;
    }

    @Override
    public TaskQuery taskAssigneeIds(List<String> assigneeIds) {
        if (assigneeIds == null) {
            throw new ActivitiIllegalArgumentException("Task assignee list is null");
        }
        if (assigneeIds.isEmpty()) {
            throw new ActivitiIllegalArgumentException("Task assignee list is empty");
        }
        for (String assignee : assigneeIds) {
            if (assignee == null) {
                throw new ActivitiIllegalArgumentException("None of the given task assignees can be null");
            }
        }

        if (assignee != null) {
            throw new ActivitiIllegalArgumentException("Invalid query usage: cannot set both taskAssigneeIds and taskAssignee");
        }
        if (assigneeLike != null) {
            throw new ActivitiIllegalArgumentException("Invalid query usage: cannot set both taskAssigneeIds and taskAssigneeLike");
        }
        if (assigneeLikeIgnoreCase != null) {
            throw new ActivitiIllegalArgumentException("Invalid query usage: cannot set both taskAssigneeIds and taskAssigneeLikeIgnoreCase");
        }

        if (orActive) {
            currentOrQueryObject.assigneeIds = assigneeIds;
        } else {
            this.assigneeIds = assigneeIds;
        }

View on GitHub (pinned to d6d39ce1c6)