{"record":{"id":"b3ab42da32790db0","repo":"flowable/flowable-engine","slug":"parent-id-is-null-b3ab42","errorCode":null,"errorMessage":"Parent id is null","messagePattern":"Parent id is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CaseInstanceQueryImpl.java","lineNumber":529,"sourceCode":"    }\n    \n    @Override\n    public CaseInstanceQueryImpl excludeCaseDefinitionKeys(Set<String> excludeCaseDefinitionKeys) {\n        if (excludeCaseDefinitionKeys == null) {\n            throw new FlowableIllegalArgumentException(\"Case definition keys is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.excludeCaseDefinitionKeys = excludeCaseDefinitionKeys;\n        } else {\n            this.excludeCaseDefinitionKeys = excludeCaseDefinitionKeys;\n        }\n        return this;\n    }\n\n    @Override\n    public CaseInstanceQueryImpl caseInstanceParentId(String parentId) {\n        if (parentId == null) {\n            throw new FlowableIllegalArgumentException(\"Parent id is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.caseInstanceParentId = parentId;\n        } else {\n            this.caseInstanceParentId = parentId;\n        }\n        return this;\n    }\n\n    @Override\n    public CaseInstanceQueryImpl caseInstanceStartedBefore(Date beforeTime) {\n        if (beforeTime == null) {\n            throw new FlowableIllegalArgumentException(\"before time is null\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.startedBefore = beforeTime;\n        } else {","sourceCodeStart":511,"sourceCodeEnd":547,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CaseInstanceQueryImpl.java#L511-L547","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass the actual parent case instance id string; verify it with caseInstance.getId()","Skip the parent filter entirely when the id is unknown instead of passing null","Null-check the parent entity before building the query"],"exampleFix":"// before\nquery.caseInstanceParentId(parentCase.getId()); // throws when parentCase is null\n// after\nif (parentCase != null) {\n    query.caseInstanceParentId(parentCase.getId());\n}","handlingStrategy":"validation","validationCode":"if (parentId != null && !parentId.isBlank()) {\n    query.caseInstanceParentId(parentId);\n}","typeGuard":"boolean hasParent(CaseInstance c) { return c != null && c.getParentId() != null; }","tryCatchPattern":"try {\n    query.caseInstanceParentId(parentId);\n} catch (FlowableIllegalArgumentException e) {\n    log.warn(\"No parent filter applied: {}\", e.getMessage());\n}","preventionTips":["Check the parent entity exists before querying children","Treat root cases (null parent) as a distinct code path","Validate REST parentId parameters before mapping into queries"],"tags":["flowable","cmmn","null-argument","query-builder"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}