flowable/flowable-engine · error · FlowableIllegalArgumentException

parentCaseInstanceId is null

Error message

parentCaseInstanceId is null

What it means

FlowableIllegalArgumentException thrown by CaseInstanceQueryImpl.parentCaseInstanceId(String) when the parentCaseInstanceId argument is null. Filtering case instances by a parent case requires an explicit id; null cannot be translated into a query condition. Pass a valid parent case instance id.

Solutions

  1. Pass a non-null parent case instance id.
  2. Skip the call when no parent filter is desired.
  3. Confirm the parent case actually exists before using its id.
  4. Add a caller-side null check on the id variable.

Example fix

// before
query.parentCaseInstanceId(parentCase.getId()); // parentCase may be null
// after
if (parentCase != null) {
    query.parentCaseInstanceId(parentCase.getId());
}
Defensive patterns

Strategy: validation

Validate before calling

if (parentCaseInstanceId != null) { query.parentCaseInstanceId(parentCaseInstanceId); }

Type guard

boolean isValidInstanceId(String id) { return id != null && !id.isEmpty(); }

Try / catch

try { query.parentCaseInstanceId(pid); } catch (FlowableIllegalArgumentException e) { log.warn("parentCaseInstanceId null: {}", e.getMessage()); }

Prevention

When it happens

Trigger: Calling parentCaseInstanceId(null) on a CaseInstanceQuery, e.g. when the parent id variable was never set or a lookup of the parent returned null.

Common situations: Case hierarchy navigation code where the case instance has no parent; using findById on a non-existent id and feeding the null result into the query.

Related errors


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

Appendix: source

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

    }

    @Override
    public CaseInstanceQuery caseInstanceCallbackType(String callbackType) {
        if (callbackType == null) {
            throw new FlowableIllegalArgumentException("callbackType is null");
        }
        if (inOrStatement) {
            this.currentOrQueryObject.callbackType = callbackType;
        } else {
            this.callbackType = callbackType;
        }
        return this;
    }
    
    @Override
    public CaseInstanceQuery parentCaseInstanceId(String parentCaseInstanceId) {
        if (parentCaseInstanceId == null) {
            throw new FlowableIllegalArgumentException("parentCaseInstanceId is null");
        }
        if (inOrStatement) {
            this.currentOrQueryObject.parentCaseInstanceId = parentCaseInstanceId;
        } else {
            this.parentCaseInstanceId = parentCaseInstanceId;
        }
        return this;
    }

    @Override
    public CaseInstanceQuery parentProcessInstanceId(String parentProcessInstanceId) {
        if (parentProcessInstanceId == null) {
            throw new FlowableIllegalArgumentException("parentProcessInstanceId is null");
        }
        if (inOrStatement) {
            this.currentOrQueryObject.parentProcessInstanceId = parentProcessInstanceId;
        } else {
            this.parentProcessInstanceId = parentProcessInstanceId;

View on GitHub (pinned to d6d39ce1c6)