flowable/flowable-engine · error · IllegalArgumentException
collection cannot be null
Error message
collection cannot be null
What it means
CollectionUtil.allOf implements DMN unary-tests like 'contains all of'; it requires the collection being tested (first argument) to be non-null. Flowable throws IllegalArgumentException immediately when the collection is null because an 'all elements in collection' check is meaningless without a target collection. This is a fail-fast precondition, not a stateful failure.
Solutions
- Initialize the collection variable before rule evaluation, e.g. execution.setVariable('items', new ArrayList<>()) instead of leaving it unset.
- Make the DMN expression null-safe: ${items != null && contains(items, allOf(required))}.
- Guard the variable producer so it always returns an empty collection, never null.
- If the variable comes from JSON input, validate required array fields before starting the DMN evaluation.
- Catch IllegalArgumentException around rule evaluation and default the rule to not-hit if the collection is missing.
Example fix
// before contains(items, allOf(required)) // items is null // after items != null && contains(items, allOf(required))
Defensive patterns
Strategy: validation
Validate before calling
if (items == null) throw new IllegalStateException("items must be initialized before DMN evaluation"); Type guard
boolean isNonEmptyCollection(Object c) { return c instanceof Collection<?>; } Try / catch
try {
boolean ok = CollectionUtil.allOf(collection, value);
} catch (IllegalArgumentException e) {
if ("collection cannot be null".equals(e.getMessage())) { /* missing DMN input data */ }
} Prevention
- Initialize collection variables to empty lists, never leave unset.
- Use null-safe unary tests (collection != null && ...).
- Validate required array fields in payloads before DMN tasks.
- Audit decision tables for every collection variable they reference.
- Default data-source mappings to empty collections.
When it happens
Trigger: A DMN input entry expression evaluates contains(..., allOf(value)) where the collection operand resolves to null — typically an unset or null list variable passed as the first argument of allOf.
Common situations: Process variable holding the list was never initialized before the DMN task; a JSON array field is absent in the payload; EL function extracting a collection returns null for missing keys.
Related errors
- value cannot be null
- activityId is null
- decision tenantId is null
- decisionDefinitionId is null
- decisionKey is null
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/12c2b3a587f82f78.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/el/util/CollectionUtil.java:35
import org.flowable.common.engine.impl.util.JsonUtil;
import org.springframework.util.CollectionUtils;
/**
* @author Yvo Swillens
*/
public class CollectionUtil {
/**
* all values of value must be in collection
*
* @return {@code true} if all elements of value are within the collection,
* {@code false} if at least one element of value is not within the collection
*/
public static boolean allOf(Object collection, Object value) {
if (collection == null) {
throw new IllegalArgumentException("collection cannot be null");
}
if (value == null) {
throw new IllegalArgumentException("value cannot be null");
}
// collection to check against
Collection targetCollection = getTargetCollection(collection, value);
// elements to check
if (DMNParseUtil.isParseableCollection(value)) {
Collection valueCollection = DMNParseUtil.parseCollection(value, targetCollection);
return valueCollection != null && targetCollection.containsAll(valueCollection);
} else if (DMNParseUtil.isJavaCollection(value)) {
return targetCollection.containsAll((Collection) value);
} else if (DMNParseUtil.isArrayNode(value)) {
Collection valueCollection = DMNParseUtil.getCollectionFromArrayNode(JsonUtil.asFlowableArrayNode(value));
return valueCollection != null && targetCollection.containsAll(valueCollection);View on GitHub (pinned to d6d39ce1c6)