{"record":{"id":"ab038b457175f05d","repo":"flowable/flowable-engine","slug":"casedefinitionid-is-null-ab038b","errorCode":null,"errorMessage":"caseDefinitionId is null","messagePattern":"caseDefinitionId is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetCmmnModelCmd.java","lineNumber":37,"sourceCode":"import org.flowable.common.engine.api.FlowableIllegalArgumentException;\nimport org.flowable.common.engine.impl.interceptor.Command;\nimport org.flowable.common.engine.impl.interceptor.CommandContext;\n\n/**\n * @author Joram Barrez\n */\npublic class GetCmmnModelCmd implements Command<CmmnModel> {\n\n    protected String caseDefinitionId;\n\n    public GetCmmnModelCmd(String caseDefinitionId) {\n        this.caseDefinitionId = caseDefinitionId;\n    }\n\n    @Override\n    public CmmnModel execute(CommandContext commandContext) {\n        if (caseDefinitionId == null) {\n            throw new FlowableIllegalArgumentException(\"caseDefinitionId is null\");\n        }\n        \n        CmmnDeploymentManager deploymentManager = CommandContextUtil.getCmmnEngineConfiguration(commandContext).getDeploymentManager();\n        CaseDefinition caseDefinition = deploymentManager.findDeployedCaseDefinitionById(caseDefinitionId);\n        if (caseDefinition != null) {\n            return deploymentManager.resolveCaseDefinition(caseDefinition).getCmmnModel();\n        }\n        return null;\n    }\n}","sourceCodeStart":19,"sourceCodeEnd":47,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetCmmnModelCmd.java#L19-L47","documentation":"GetCmmnModelCmd requires a caseDefinitionId to resolve the CMMN model from the deployment cache/manager. A null id makes resolution impossible, so Flowable throws FlowableIllegalArgumentException before any lookup. It guards the internal model-resolution path (findDeployedCaseDefinitionById).","triggerScenarios":"Calling getCmmnModel(caseDefinitionId) style APIs with a null caseDefinitionId, e.g. cmmnRepositoryService.getCmmnModel(null) or a caller passing an unset definition id.","commonSituations":"Definition id obtained from a case instance's variable or response field that is null; integration code that never set the id; template/config-driven lookups with a missing placeholder value.","solutions":["Supply a valid non-null caseDefinitionId","Resolve the definition id from the case instance (caseInstance.getCaseDefinitionId()) before calling","Add boundary validation that the id is present"],"exampleFix":"// before\nCmmnModel model = repositoryService.getCmmnModel(caseDefinitionId);\n// after\nString defId = Optional.ofNullable(caseInstance).map(CaseInstance::getCaseDefinitionId).orElse(caseDefinitionId);\nif (defId == null) {\n    throw new IllegalArgumentException(\"caseDefinitionId must be provided\");\n}\nCmmnModel model = repositoryService.getCmmnModel(defId);","handlingStrategy":"validation","validationCode":"if (caseDefinitionId == null || caseDefinitionId.isEmpty()) { throw new IllegalArgumentException(\"caseDefinitionId required\"); }","typeGuard":"boolean hasDefId = defId != null && !defId.trim().isEmpty();","tryCatchPattern":"try { return repositoryService.getCmmnModel(caseDefinitionId); } catch (FlowableIllegalArgumentException e) { log.error(\"Missing case definition id\"); throw e; }","preventionTips":["Derive the definition id from the case instance when possible","Validate ids before invoking repository APIs","Keep definition ids in typed config, not free-form strings"],"tags":["java","flowable","null-check","cmmn-model"],"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"}