{"record":{"id":"289be803308da2a5","repo":"flowable/flowable-engine","slug":"the-deployment-contains-decisions-with-the-same-ke","errorCode":null,"errorMessage":"The deployment contains decisions with the same key (decision id attribute), this is not allowed","messagePattern":"The deployment contains decisions with the same key \\(decision id attribute\\), this is not allowed","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/deployer/DmnDeploymentHelper.java","lineNumber":48,"sourceCode":"import org.flowable.dmn.engine.impl.util.CommandContextUtil;\n\n/**\n * Methods for working with deployments. Much of the actual work of {@link DmnDeployer} is done by orchestrating the different pieces of work this class does; by having them here, we allow other\n * deployers to make use of them.\n */\npublic class DmnDeploymentHelper {\n\n    /**\n     * Verifies that no two decisions share the same key, to prevent database unique index violation.\n     * \n     * @throws FlowableException\n     *             if any two decisions have the same key\n     */\n    public void verifyDecisionTablesDoNotShareKeys(Collection<DecisionEntity> decisionTables) {\n        Set<String> keySet = new LinkedHashSet<>();\n        for (DecisionEntity decisionTable : decisionTables) {\n            if (keySet.contains(decisionTable.getKey())) {\n                throw new FlowableException(\n                        \"The deployment contains decisions with the same key (decision id attribute), this is not allowed\");\n            }\n            keySet.add(decisionTable.getKey());\n        }\n    }\n\n    /**\n     * Updates all the decision entities to match the deployment's values for tenant, engine version, and deployment id.\n     */\n    public void copyDeploymentValuesToDecisions(DmnDeploymentEntity deployment, List<DecisionEntity> decisions) {\n        String tenantId = deployment.getTenantId();\n        String deploymentId = deployment.getId();\n\n        for (DecisionEntity decision : decisions) {\n            // decision inherits the tenant id\n            if (tenantId != null) {\n                decision.setTenantId(tenantId);\n            }","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/deployer/DmnDeploymentHelper.java#L30-L66","documentation":"DmnDeploymentHelper.verifyDecisionTablesDoNotShareKeys enforces that all decisions in one deployment have distinct keys (the DMN <decision id> attribute). A duplicate key makes per-key version resolution ambiguous, so deployment fails with FlowableException.","triggerScenarios":"Deploying a .dmn file (or set of resources) containing two <decision> elements with the same id attribute; merging DMN files that each define a decision with the same id; case-insensitive collisions across included resources in one deployment.","commonSituations":"Copy-pasting a decision table inside one DMN file to tweak it without renaming the id; concatenating DRD files from different sources that reuse ids like \"decision1\"; auto-generated DMN from tooling that emits fixed ids.","solutions":["Rename the duplicate <decision id=\"...\"> to a unique key within the deployment.","Split colliding decisions into separate deployments if they must keep identical keys (versions are per-key across deployments).","Lint DMN resources with an XML check for duplicate ids before deploying.","If versions differ, ensure each decision's id attribute is unique and reference decisions via DRD accordingly."],"exampleFix":"// before (in .dmn XML)\n<decision id=\"myDecision\" name=\"A\">...</decision>\n<decision id=\"myDecision\" name=\"B\">...</decision>\n// after\n<decision id=\"myDecisionA\" name=\"A\">...</decision>\n<decision id=\"myDecisionB\" name=\"B\">...</decision>","handlingStrategy":"validation","validationCode":"Set<String> seen = new HashSet<>();\nfor (String id : allDecisionIdsInResources) {\n    if (!seen.add(id)) throw new IllegalStateException(\"Duplicate decision id: \" + id);\n}","typeGuard":null,"tryCatchPattern":"try {\n    repositoryService.createDeployment().addClasspathResource(\"decision.dmn\").deploy();\n} catch (FlowableException e) {\n    if (e.getMessage().contains(\"same key\")) { /* fix duplicate ids */ }\n}","preventionTips":["Enforce unique <decision id> attributes across all resources in a deployment","Add a pre-deploy DMN lint step","Avoid copy-pasting decisions without renaming ids","Prefer separate deployments when reusing the same key intentionally"],"tags":["flowable","dmn","duplicate-key","deployment","validation"],"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"}