flowable/flowable-engine · error · FlowableIllegalArgumentException

Parent id is null

Error message

Parent id is null

What it means

HistoricCaseInstanceQueryImpl.caseInstanceParentId() throws FlowableIllegalArgumentException when the parent case instance id is null. The parent id is compared for equality in the generated SQL, so a null value is rejected immediately, before assignment to the query or the current or-query object.

Source

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

    }
    
    @Override
    public HistoricCaseInstanceQueryImpl 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 HistoricCaseInstanceQueryImpl 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 HistoricCaseInstanceQuery withoutCaseInstanceParent() {
        if (inOrStatement) {
            this.currentOrQueryObject.withoutCaseInstanceParentId = true;
        } else {
            this.withoutCaseInstanceParentId = true;
        }
        return this;
    }

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Pass a valid parent case instance id string, e.g. caseInstanceParentId(parentCase.getId()).
  2. Skip the call when parentId is null so the query returns all cases (or handle the 'no parent' case explicitly).
  3. Validate route/request parameters before building the query and reject the request if the id is required.
  4. Catch FlowableIllegalArgumentException to return a clear 'parent id required' message.

Example fix

// before
query.caseInstanceParentId(request.getParameter("parentId"));
// after
String parentId = request.getParameter("parentId");
if (parentId != null) {
    query.caseInstanceParentId(parentId);
}
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

boolean hasParentId(String parentId) {
    return parentId != null && !parentId.isBlank();
}

Try / catch

try {
    query.caseInstanceParentId(parentId);
} catch (FlowableIllegalArgumentException e) {
    throw new InvalidRequestException("parentId is required for this view");
}

Prevention

When it happens

Trigger: Calling caseInstanceParentId(null), typically when the parent id is derived from a navigation context (e.g. a child-case page whose parent parameter is absent) and passed unconditionally.

Common situations: Parent/child case hierarchies in web apps: a deep link or missing route parameter leaves parentId null; also happens after upgrading integrations where the parent id lookup API started returning null.

Related errors


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