{"record":{"id":"5f90786c6d7416e2","repo":"flowable/flowable-engine","slug":"the-deployment-contains-case-definitions-with-the","errorCode":null,"errorMessage":"The deployment contains case definitions with the same key (case id attribute), this is not allowed","messagePattern":"The deployment contains case definitions with the same key \\(case id attribute\\), this is not allowed","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/deployer/CmmnDeployer.java","lineNumber":269,"sourceCode":"    }\n\n    protected void makeCaseDefinitionsConsistentWithPersistedVersions(CmmnParseResult parseResult) {\n        for (CaseDefinitionEntity caseDefinition : parseResult.getAllCaseDefinitions()) {\n            CaseDefinitionEntity persistedCaseDefinition = getPersistedInstanceOfCaseDefinition(caseDefinition);\n            if (persistedCaseDefinition != null) {\n                caseDefinition.setId(persistedCaseDefinition.getId());\n                caseDefinition.setVersion(persistedCaseDefinition.getVersion());\n                caseDefinition.setHasStartFormKey(persistedCaseDefinition.hasStartFormKey());\n                caseDefinition.setHasGraphicalNotation(persistedCaseDefinition.hasGraphicalNotation());\n            }\n        }\n    }\n\n    protected void verifyCaseDefinitionsDoNotShareKeys(Collection<CaseDefinitionEntity> caseDefinitionEntities) {\n        Set<String> keySet = new LinkedHashSet<>();\n        for (CaseDefinitionEntity caseDefinitionEntity : caseDefinitionEntities) {\n            if (keySet.contains(caseDefinitionEntity.getKey())) {\n                throw new FlowableException(\"The deployment contains case definitions with the same key (case id attribute), this is not allowed\");\n            }\n            keySet.add(caseDefinitionEntity.getKey());\n        }\n    }\n\n    protected void copyDeploymentValuesToCaseDefinitions(EngineDeployment deployment, List<CaseDefinitionEntity> caseDefinitionEntities) {\n        String tenantId = deployment.getTenantId();\n        String deploymentId = deployment.getId();\n\n        for (CaseDefinitionEntity caseDefinitionEntity : caseDefinitionEntities) {\n            if (tenantId != null) {\n                caseDefinitionEntity.setTenantId(tenantId);\n            }\n            caseDefinitionEntity.setDeploymentId(deploymentId);\n        }\n    }\n\n    protected void setResourceNamesOnCaseDefinitions(CmmnParseResult parseResult) {","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/deployer/CmmnDeployer.java#L251-L287","documentation":"During deployment CmmnDeployer collects all case definitions parsed from the deployment and verifies no two share the same key (the case id attribute in the CMMN XML). Duplicate keys within a single deployment are ambiguous for the deployer and are rejected with a plain FlowableException.","triggerScenarios":"Deploying a single deployment whose resources contain two or more case definitions with the same id/case attribute — e.g. a bar/zip with two .cmmn files both declaring <case id=\"myCase\">, or the same file included twice.","commonSituations":"Zipping a case model directory where a case was copy-pasted and the id not changed; packaging old and new versions of the same case XML into one deployment; Maven resource filtering merging duplicate files.","solutions":["Ensure each <case id=\"...\"> in the deployment's resources has a unique key","Rename the duplicate case id in one of the CMMN XML files and redeploy","Split the resources across two deployments if they intentionally reuse keys"],"exampleFix":"// before (two files in one deployment)\n<case id=\"creditCheck\">... in creditCheck.cmmn\n<case id=\"creditCheck\">... in creditCheckV2.cmmn\n// after\n<case id=\"creditCheck\"> in creditCheck.cmmn\n<case id=\"creditCheckV2\"> in creditCheckV2.cmmn","handlingStrategy":"validation","validationCode":"Set<String> keys = caseDefinitionEntities.stream().map(CaseDefinition::getKey).collect(Collectors.toSet()); if (keys.size() < caseDefinitionEntities.size()) throw new IllegalStateException(\"Duplicate case keys in deployment\");","typeGuard":null,"tryCatchPattern":"try { repositoryService.createDeployment().addZipInputStream(zis).deploy(); } catch (FlowableException e) { if (e.getMessage().contains(\"same key\")) { /* fix model ids */ } }","preventionTips":["Enforce unique <case id> across all CMMN resources of a deployment","Add a build-time lint that scans .cmmn files for duplicate case ids"],"tags":["deployment","validation","duplicate-key","cmmn"],"backgroundTag":"schema-validation-failed","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}