flowable/flowable-engine · error · FlowableIllegalArgumentException

Element id is null

Error message

Element id is null

What it means

Flowable's PlanItemInstanceQuery.planItemInstanceElementId() throws FlowableIllegalArgumentException when the elementId parameter is null. The element id is the XML id of the plan item/element in the CMMN model, used for model-based filtering; null is rejected in the setter before query execution.

Solutions

  1. Pass a valid CMMN element id as defined in the case model XML
  2. Make the filter conditional on the value being non-null
  3. Verify the element id against the deployed case definition (ids change when the model is edited)

Example fix

// before
query.planItemInstanceElementId(elementId); // throws when elementId == null

// after
if (elementId != null) {
    query.planItemInstanceElementId(elementId);
}
Defensive patterns

Strategy: validation

Validate before calling

if (elementId != null && !elementId.isBlank()) {
    query.planItemInstanceElementId(elementId);
}

Type guard

boolean isPresent(String id) { return id != null && !id.isBlank(); }

Try / catch

try {
    query.planItemInstanceElementId(elementId);
} catch (FlowableIllegalArgumentException e) {
    log.warn("Element filter skipped: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Calling planItemInstanceElementId(null), commonly when the element id is derived from an expression, a model node reference that didn't resolve, or an optional request parameter that is absent.

Common situations: Code that reads element ids from BPMN/CMMN model introspection where the node lookup fails; UI filtering where the user hasn't selected an element yet; renaming elements in the model while old ids are referenced in code/config.

Related errors


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

Appendix: source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/PlanItemInstanceQueryImpl.java:206

    }
    
    @Override
    public PlanItemInstanceQuery planItemInstanceId(String planItemInstanceId) {
        if (planItemInstanceId == null) {
            throw new FlowableIllegalArgumentException("Plan Item instance id is null");
        }
        if (inOrStatement) {
            this.currentOrQueryObject.planItemInstanceId = planItemInstanceId;
        } else {
            this.planItemInstanceId = planItemInstanceId;
        }
        return this;
    }
    
    @Override
    public PlanItemInstanceQuery planItemInstanceElementId(String elementId) {
        if (elementId == null) {
            throw new FlowableIllegalArgumentException("Element id is null");
        }
        if (inOrStatement) {
            this.currentOrQueryObject.elementId = elementId;
        } else {
            this.elementId = elementId;
        }
        return this;
    }
    
    @Override
    public PlanItemInstanceQuery planItemDefinitionId(String planItemDefinitionId) {
        if (planItemDefinitionId == null) {
            throw new FlowableIllegalArgumentException("Plan item definition id is null");
        }
        if (inOrStatement) {
            this.currentOrQueryObject.planItemDefinitionId = planItemDefinitionId;
        } else {
            this.planItemDefinitionId = planItemDefinitionId;

View on GitHub (pinned to d6d39ce1c6)