flowable/flowable-engine · error · FlowableIllegalArgumentException

Provided element ids are null

Error message

Provided element ids are null

What it means

DeadLetterJobQueryImpl.elementIds(Collection<String>) throws FlowableIllegalArgumentException when the whole collection is null. Flowable distinguishes a null collection (invalid input, rejected) from an empty collection (a filter that matches nothing). Only the collection reference itself is checked; null elements inside the collection are not validated here.

Solutions

  1. Null-check the collection before calling elementIds(...)
  2. If the caller passed an empty list intentionally, note that empty means 'match nothing' - decide which semantics you want
  3. Initialize the collection to Collections.emptyList() at declaration to avoid null references
  4. Coerce missing request fields to empty lists at deserialization time

Example fix

// before
query.elementIds(request.getElementIds()); // null when field absent

// after
Collection<String> ids = request.getElementIds();
DeadLetterJobQuery query = jobService.createDeadLetterJobQuery();
if (ids != null && !ids.isEmpty()) {
    query = query.elementIds(ids);
}
Defensive patterns

Strategy: validation

Validate before calling

Collection<String> ids = request.getElementIds();
if (ids != null && !ids.isEmpty()) {
    query = query.elementIds(ids);
}

Type guard

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

Try / catch

try {
    return query.elementIds(elementIds).list();
} catch (FlowableIllegalArgumentException e) {
    throw new InvalidQueryRequestException("elementIds collection must not be null", e);
}

Prevention

When it happens

Trigger: Calling deadLetterJobQuery().elementIds(null), usually when the list was initialized conditionally and never assigned, or a deserialized request omitted the field so the mapper left it null.

Common situations: REST/GraphQL queries where the elementIds array is optional and deserializes to null; code paths that build the collection only under a condition but always call the setter; Jackson/Gson binding producing null for missing JSON keys.

Related errors


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

Appendix: source

Thrown at modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/DeadLetterJobQueryImpl.java:213

    }
    
    @Override
    public DeadLetterJobQueryImpl elementId(String elementId) {
        if (elementId == null) {
            throw new FlowableIllegalArgumentException("Provided element id is null");
        }
        if (inOrStatement) {
            this.currentOrQueryObject.elementId = elementId;
        } else {
            this.elementId = elementId;
        }
        return this;
    }

    @Override
    public DeadLetterJobQuery elementIds(Collection<String> elementIds) {
        if (elementIds == null) {
            throw new FlowableIllegalArgumentException("Provided element ids are null");
        }
        if (inOrStatement) {
            this.currentOrQueryObject.elementIds = elementIds;
        } else {
            this.elementIds = elementIds;
        }
        return this;
    }
    
    @Override
    public DeadLetterJobQueryImpl elementName(String elementName) {
        if (elementName == null) {
            throw new FlowableIllegalArgumentException("Provided element name is null");
        }
        if (inOrStatement) {
            this.currentOrQueryObject.elementName = elementName;
        } else {
            this.elementName = elementName;

View on GitHub (pinned to d6d39ce1c6)