flowable/flowable-engine · error · FlowableIllegalArgumentException

Task ids are null

Error message

Task ids are null

What it means

Flowable throws this FlowableIllegalArgumentException when TaskQuery.taskIds(null) is called. The batch task-id filter requires a non-null collection to build the SQL IN clause. The rejection is immediate at query-construction time.

Solutions

  1. Pass Collections.emptyList() instead of null if there are no ids, and skip the filter for empty lists.
  2. Null-check the collection before calling taskIds and either omit the filter or throw your own descriptive error.
  3. Ensure the upstream code producing the collection always initializes it (e.g. Stream.collect(Collectors.toList()) never returns null).
  4. Validate request payloads so an absent id list is rejected at the boundary.

Example fix

// before
query.taskIds(request.getTaskIds()); // throws when null
// after
List<String> ids = request.getTaskIds();
if (ids != null && !ids.isEmpty()) {
    query.taskIds(ids);
}
Defensive patterns

Strategy: validation

Validate before calling

if (taskIds == null) { taskIds = Collections.emptyList(); }
if (!taskIds.isEmpty()) {
    query.taskIds(taskIds);
}

Type guard

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

Try / catch

try {
    query.taskIds(ids);
} catch (FlowableIllegalArgumentException e) {
    if (e.getMessage().equals("Task ids are null")) {
        log.warn("taskIds was null; applying query without id filter");
        query = taskService.createTaskQuery();
    } else { throw e; }
}

Prevention

When it happens

Trigger: Calling taskService.createTaskQuery().taskIds(null), commonly when the collection comes from a method parameter, stream result, or optional field that was null.

Common situations: Batch endpoints where the caller supplied no ids and the null collection was forwarded; helper methods assembling task queries from optional id lists.

Related errors


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

Appendix: source

Thrown at modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java:226

    @Override
    public TaskQueryImpl taskId(String taskId) {
        if (taskId == null) {
            throw new FlowableIllegalArgumentException("Task id is null");
        }

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

    @Override
    public TaskQuery taskIds(Collection<String> taskIds) {
        if (taskIds == null) {
            throw new FlowableIllegalArgumentException("Task ids are null");
        }
        if (orActive) {
            currentOrQueryObject.taskIds = taskIds;
        } else {
            this.taskIds = taskIds;
        }
        return this;
    }

    @Override
    public TaskQueryImpl taskName(String name) {
        if (name == null) {
            throw new FlowableIllegalArgumentException("Task name is null");
        }

        if (orActive) {
            currentOrQueryObject.name = name;
        } else {

View on GitHub (pinned to d6d39ce1c6)