{"record":{"id":"b4fb2bce1066f5e9","repo":"flowable/flowable-engine","slug":"parent-id-is-null","errorCode":null,"errorMessage":"Parent id is null","messagePattern":"Parent id is null","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/HistoricCaseInstanceQueryImpl.java","lineNumber":526,"sourceCode":"    }\n    \n    @Override\n    public HistoricCaseInstanceQueryImpl 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 HistoricCaseInstanceQueryImpl 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 HistoricCaseInstanceQuery withoutCaseInstanceParent() {\n        if (inOrStatement) {\n            this.currentOrQueryObject.withoutCaseInstanceParentId = true;\n        } else {\n            this.withoutCaseInstanceParentId = true;\n        }\n        return this;\n    }","sourceCodeStart":508,"sourceCodeEnd":544,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/HistoricCaseInstanceQueryImpl.java#L508-L544","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass a valid parent case instance id string, e.g. caseInstanceParentId(parentCase.getId()).","Skip the call when parentId is null so the query returns all cases (or handle the 'no parent' case explicitly).","Validate route/request parameters before building the query and reject the request if the id is required.","Catch FlowableIllegalArgumentException to return a clear 'parent id required' message."],"exampleFix":"// before\nquery.caseInstanceParentId(request.getParameter(\"parentId\"));\n// after\nString parentId = request.getParameter(\"parentId\");\nif (parentId != null) {\n    query.caseInstanceParentId(parentId);\n}","handlingStrategy":"validation","validationCode":"if (parentId != null && !parentId.isBlank()) {\n    query.caseInstanceParentId(parentId);\n}","typeGuard":"boolean hasParentId(String parentId) {\n    return parentId != null && !parentId.isBlank();\n}","tryCatchPattern":"try {\n    query.caseInstanceParentId(parentId);\n} catch (FlowableIllegalArgumentException e) {\n    throw new InvalidRequestException(\"parentId is required for this view\");\n}","preventionTips":["Validate route/request parameters before building queries","Reject requests where a required parent id is missing rather than passing null","Check lookup results (e.g. parent case existence) before using their ids","Add tests for deep links with missing parent parameters"],"tags":["flowable","cmmn","query","null-argument","parent-id"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}