{"record":{"id":"8acd622463e6e0cd","repo":"flowable/flowable-engine","slug":"element-id-is-null","errorCode":null,"errorMessage":"Element id is null","messagePattern":"Element 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/PlanItemInstanceQueryImpl.java","lineNumber":206,"sourceCode":"    }\n    \n    @Override\n    public PlanItemInstanceQuery planItemInstanceId(String planItemInstanceId) {\n        if (planItemInstanceId == null) {\n            throw new FlowableIllegalArgumentException(\"Plan Item instance id is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.planItemInstanceId = planItemInstanceId;\n        } else {\n            this.planItemInstanceId = planItemInstanceId;\n        }\n        return this;\n    }\n    \n    @Override\n    public PlanItemInstanceQuery planItemInstanceElementId(String elementId) {\n        if (elementId == null) {\n            throw new FlowableIllegalArgumentException(\"Element id is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.elementId = elementId;\n        } else {\n            this.elementId = elementId;\n        }\n        return this;\n    }\n    \n    @Override\n    public PlanItemInstanceQuery planItemDefinitionId(String planItemDefinitionId) {\n        if (planItemDefinitionId == null) {\n            throw new FlowableIllegalArgumentException(\"Plan item definition id is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.planItemDefinitionId = planItemDefinitionId;\n        } else {\n            this.planItemDefinitionId = planItemDefinitionId;","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/PlanItemInstanceQueryImpl.java#L188-L224","documentation":"Flowable's PlanItemInstanceQuery.planItemInstanceElementId() throws FlowableIllegalArgumentException when the elementId parameter is null. The element id is the XML id of the plan item/element in the CMMN model, used for model-based filtering; null is rejected in the setter before query execution.","triggerScenarios":"Calling planItemInstanceElementId(null), commonly when the element id is derived from an expression, a model node reference that didn't resolve, or an optional request parameter that is absent.","commonSituations":"Code that reads element ids from BPMN/CMMN model introspection where the node lookup fails; UI filtering where the user hasn't selected an element yet; renaming elements in the model while old ids are referenced in code/config.","solutions":["Pass a valid CMMN element id as defined in the case model XML","Make the filter conditional on the value being non-null","Verify the element id against the deployed case definition (ids change when the model is edited)"],"exampleFix":"// before\nquery.planItemInstanceElementId(elementId); // throws when elementId == null\n\n// after\nif (elementId != null) {\n    query.planItemInstanceElementId(elementId);\n}","handlingStrategy":"validation","validationCode":"if (elementId != null && !elementId.isBlank()) {\n    query.planItemInstanceElementId(elementId);\n}","typeGuard":"boolean isPresent(String id) { return id != null && !id.isBlank(); }","tryCatchPattern":"try {\n    query.planItemInstanceElementId(elementId);\n} catch (FlowableIllegalArgumentException e) {\n    log.warn(\"Element filter skipped: {}\", e.getMessage());\n}","preventionTips":["Null-check model/node lookups before using the resolved element id","Keep element ids used in code/config in sync with the deployed CMMN model","Treat optional UI selections as 'filter absent', not null"],"tags":["flowable","cmmn","query","null-argument"],"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"}