flowable/flowable-engine · error · FlowableIllegalArgumentException

parent case instance id is null

Error message

parent case instance id is null

What it means

HistoricCaseInstanceQueryImpl.parentCaseInstanceId(String) requires a non-null parent case instance id, since it is used as a direct equality predicate on the parentCaseInstanceId column. A null argument cannot be translated into a valid SQL condition, so a FlowableIllegalArgumentException is thrown immediately.

Solutions

  1. Pass a valid, existing parent case instance id string.
  2. If you want root cases, use caseInstanceParentIdIsNull()/the parent-null variant instead of passing null.
  3. Guard the call with a null check and skip the parent filter when the id is unknown.

Example fix

// before
query.parentCaseInstanceId(parentId); // parentId may be null for root cases
// after
if (parentId != null) {
    query.parentCaseInstanceId(parentId);
} else {
    query.caseInstanceWithoutParent(); // or omit the filter
}
Defensive patterns

Strategy: validation

Validate before calling

if (parentCaseInstanceId != null) {
    query.parentCaseInstanceId(parentCaseInstanceId);
} // else: omit parent filter or use the parent-is-null variant for root cases

Type guard

boolean isSet(String s) { return s != null && !s.trim().isEmpty(); }

Try / catch

try {
    query.parentCaseInstanceId(parentId);
} catch (FlowableIllegalArgumentException e) {
    log.warn("No parent filter applied: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Calling parentCaseInstanceId(null) on a HistoricCaseInstanceQuery; commonly when the parent id variable was never set or a lookup of the parent case instance returned null.

Common situations: Querying children of a case instance whose parent id was resolved via an API call that returned null (e.g. root case instances have no parent); iterating a map of parent ids that contains a null entry.

Related errors


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

Appendix: source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/HistoricCaseInstanceQueryImpl.java:770

    }
    
    @Override
    public HistoricCaseInstanceQuery caseInstanceCallbackType(String callbackType) {
        if (callbackType == null) {
            throw new FlowableIllegalArgumentException("callback type is null");
        }
        if (inOrStatement) {
            this.currentOrQueryObject.callbackType = callbackType;
        } else {
            this.callbackType = callbackType;
        }
        return this;
    }
    
    @Override
    public HistoricCaseInstanceQuery parentCaseInstanceId(String parentCaseInstanceId) {
        if (parentCaseInstanceId == null) {
            throw new FlowableIllegalArgumentException("parent case instance id is null");
        }
        if (inOrStatement) {
            this.currentOrQueryObject.parentCaseInstanceId = parentCaseInstanceId;
        } else {
            this.parentCaseInstanceId = parentCaseInstanceId;
        }
        return this;
    }

    @Override
    public HistoricCaseInstanceQuery 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)