{"record":{"id":"9077dac87935d76a","repo":"flowable/flowable-engine","slug":"the-element-id-must-be-provided-for-the-plan-item","errorCode":null,"errorMessage":"The element id must be provided for the plan item instance","messagePattern":"The element id must be provided for the plan item instance","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/InjectedPlanItemInstanceBuilderImpl.java","lineNumber":77,"sourceCode":"    public PlanItemInstance createInStage(String stagePlanItemInstanceId) {\n        validateData();\n        this.stagePlanItemInstanceId = stagePlanItemInstanceId;\n        return commandExecutor.execute(new CreateInjectedPlanItemInstanceCmd(this));\n    }\n\n    @Override\n    public PlanItemInstance createInCase(String caseInstanceId) {\n        validateData();\n        this.caseInstanceId = caseInstanceId;\n        return commandExecutor.execute(new CreateInjectedPlanItemInstanceCmd(this));\n    }\n\n    protected void validateData() {\n        if (caseDefinitionId == null) {\n            throw new FlowableIllegalArgumentException(\"The case definition id must be provided for the plan item instance\");\n        }\n        if (elementId == null) {\n            throw new FlowableIllegalArgumentException(\"The element id must be provided for the plan item instance\");\n        }\n    }\n\n    public boolean injectInStage() {\n        return stagePlanItemInstanceId != null;\n    }\n    public boolean injectInCase() {\n        return caseInstanceId != null;\n    }\n    public String getStagePlanItemInstanceId() {\n        return stagePlanItemInstanceId;\n    }\n    public String getCaseInstanceId() {\n        return caseInstanceId;\n    }\n    public String getName() {\n        return name;\n    }","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/InjectedPlanItemInstanceBuilderImpl.java#L59-L95","documentation":"InjectedPlanItemInstanceBuilderImpl.validateData() requires an elementId identifying the plan item (CMMN element) to inject. A null elementId means the engine cannot locate the model element, so FlowableIllegalArgumentException is thrown before createInStage/createInCase proceeds.","triggerScenarios":"Building the injected plan item instance builder without calling elementId(String), or passing null because the element id came from an unfound lookup/config.","commonSituations":"Wrong element id key in configuration; referencing an element id that does not exist in the CMMN diagram; copy-pasted builder code omitting elementId.","solutions":["Call elementId(\"<element id from CMMN XML>\") before createInStage/createInCase","Verify the element id exists in the deployed case definition's model","Null-check configuration/lookup that supplies the element id"],"exampleFix":"// before\nbuilder.caseDefinitionId(defId).createInCase(caseInstanceId); // elementId missing\n// after\nbuilder.caseDefinitionId(defId)\n    .elementId(\"humanTask1\")\n    .createInCase(caseInstanceId);","handlingStrategy":"validation","validationCode":"if (elementId == null || elementId.isEmpty()) throw new IllegalArgumentException(\"elementId required\");","typeGuard":"boolean hasText(String s) { return s != null && !s.trim().isEmpty(); }","tryCatchPattern":"try { builder.createInCase(caseInstanceId); } catch (FlowableIllegalArgumentException e) { log.error(\"Injection data invalid: {}\", e.getMessage()); }","preventionTips":["Copy element ids directly from the CMMN XML, not from memory","Keep element ids in constants or an enum generated from the model","Validate config files supplying element ids at startup"],"tags":["flowable","cmmn","plan-item","injection","validation"],"backgroundTag":"missing-required-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"}