{"record":{"id":"8f850f608fe6773c","repo":"flowable/flowable-engine","slug":"parentcaseinstanceid-is-null","errorCode":null,"errorMessage":"parentCaseInstanceId is null","messagePattern":"parentCaseInstanceId 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":674,"sourceCode":"    }\n\n    @Override\n    public CaseInstanceQuery caseInstanceCallbackType(String callbackType) {\n        if (callbackType == null) {\n            throw new FlowableIllegalArgumentException(\"callbackType is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.callbackType = callbackType;\n        } else {\n            this.callbackType = callbackType;\n        }\n        return this;\n    }\n    \n    @Override\n    public CaseInstanceQuery parentCaseInstanceId(String parentCaseInstanceId) {\n        if (parentCaseInstanceId == null) {\n            throw new FlowableIllegalArgumentException(\"parentCaseInstanceId is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.parentCaseInstanceId = parentCaseInstanceId;\n        } else {\n            this.parentCaseInstanceId = parentCaseInstanceId;\n        }\n        return this;\n    }\n\n    @Override\n    public CaseInstanceQuery parentProcessInstanceId(String parentProcessInstanceId) {\n        if (parentProcessInstanceId == null) {\n            throw new FlowableIllegalArgumentException(\"parentProcessInstanceId is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.parentProcessInstanceId = parentProcessInstanceId;\n        } else {\n            this.parentProcessInstanceId = parentProcessInstanceId;","sourceCodeStart":656,"sourceCodeEnd":692,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CaseInstanceQueryImpl.java#L656-L692","documentation":"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.","triggerScenarios":"Calling parentCaseInstanceId(null) on a CaseInstanceQuery, e.g. when the parent id variable was never set or a lookup of the parent returned null.","commonSituations":"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.","solutions":["Pass a non-null parent case instance id.","Skip the call when no parent filter is desired.","Confirm the parent case actually exists before using its id.","Add a caller-side null check on the id variable."],"exampleFix":"// before\nquery.parentCaseInstanceId(parentCase.getId()); // parentCase may be null\n// after\nif (parentCase != null) {\n    query.parentCaseInstanceId(parentCase.getId());\n}","handlingStrategy":"validation","validationCode":"if (parentCaseInstanceId != null) { query.parentCaseInstanceId(parentCaseInstanceId); }","typeGuard":"boolean isValidInstanceId(String id) { return id != null && !id.isEmpty(); }","tryCatchPattern":"try { query.parentCaseInstanceId(pid); } catch (FlowableIllegalArgumentException e) { log.warn(\"parentCaseInstanceId null: {}\", e.getMessage()); }","preventionTips":["Verify parent entity existence before using its id in filters.","Guard lookups whose result may be null (findById may return nothing).","Skip parent filters for top-level case instances."],"tags":["flowable","cmmn","query","null-check"],"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"}