flowable/flowable-engine · error · FlowableIllegalArgumentException

Parent id is null

Error message

Parent id is null

What it means

Flowable throws this FlowableIllegalArgumentException when CaseInstanceQueryImpl.caseInstanceParentId(String) is called with a null parentId. Parent id is used to filter case instances whose parent (e.g. a root case or process-linked parent) matches; null is not a meaningful filter value, so the engine rejects it early.

Solutions

  1. Pass the actual parent case instance id string; verify it with caseInstance.getId()
  2. Skip the parent filter entirely when the id is unknown instead of passing null
  3. Null-check the parent entity before building the query

Example fix

// before
query.caseInstanceParentId(parentCase.getId()); // throws when parentCase is null
// after
if (parentCase != null) {
    query.caseInstanceParentId(parentCase.getId());
}
Defensive patterns

Strategy: validation

Validate before calling

if (parentId != null && !parentId.isBlank()) {
    query.caseInstanceParentId(parentId);
}

Type guard

boolean hasParent(CaseInstance c) { return c != null && c.getParentId() != null; }

Try / catch

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

Prevention

When it happens

Trigger: Calling caseInstanceQuery.caseInstanceParentId(null) directly, or forwarding a null parentId obtained from another case instance (e.g. getParentId() on a root case) into a new query.

Common situations: Querying child cases where the parent lookup returned null (root case has no parent); passing a JSON body field 'parentId' that was omitted; mixing up caseInstanceParentId with caseInstanceId.

Related errors


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

Appendix: source

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

    }
    
    @Override
    public CaseInstanceQueryImpl excludeCaseDefinitionKeys(Set<String> excludeCaseDefinitionKeys) {
        if (excludeCaseDefinitionKeys == null) {
            throw new FlowableIllegalArgumentException("Case definition keys is null");
        }
        if (inOrStatement) {
            this.currentOrQueryObject.excludeCaseDefinitionKeys = excludeCaseDefinitionKeys;
        } else {
            this.excludeCaseDefinitionKeys = excludeCaseDefinitionKeys;
        }
        return this;
    }

    @Override
    public CaseInstanceQueryImpl caseInstanceParentId(String parentId) {
        if (parentId == null) {
            throw new FlowableIllegalArgumentException("Parent id is null");
        }
        if (inOrStatement) {
            this.currentOrQueryObject.caseInstanceParentId = parentId;
        } else {
            this.caseInstanceParentId = parentId;
        }
        return this;
    }

    @Override
    public CaseInstanceQueryImpl caseInstanceStartedBefore(Date beforeTime) {
        if (beforeTime == null) {
            throw new FlowableIllegalArgumentException("before time is null");
        }

        if (inOrStatement) {
            this.currentOrQueryObject.startedBefore = beforeTime;
        } else {

View on GitHub (pinned to d6d39ce1c6)