{"record":{"id":"95d53e09ebd92353","repo":"flowable/flowable-engine","slug":"the-deployment-contains-process-definitions-with-t-95d53e","errorCode":null,"errorMessage":"The deployment contains process definitions with the same key '%s' (process id attribute), this is not allowed","messagePattern":"The deployment contains process definitions with the same key '(.+?)' \\(process id attribute\\), this is not allowed","errorType":"exception","errorClass":"ActivitiException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/deployer/BpmnDeployer.java","lineNumber":182,"sourceCode":"                            } catch (Throwable t) { // if anything goes wrong, we don't store the image (the process will still be executable).\n                                LOGGER.warn(\"Error while generating process diagram, image will not be stored in repository\", t);\n                            }\n                        }\n                    }\n\n                    processDefinition.setDiagramResourceName(diagramResourceName);\n                    processDefinition.setEngineVersion(\"v5\");\n                    processDefinitions.add(processDefinition);\n                    bpmnModelMap.put(processDefinition.getKey(), bpmnParse.getBpmnModel());\n                }\n            }\n        }\n\n        // check if there are process definitions with the same process key to prevent database unique index violation\n        List<String> keyList = new ArrayList<>();\n        for (ProcessDefinitionEntity processDefinition : processDefinitions) {\n            if (keyList.contains(processDefinition.getKey())) {\n                throw new ActivitiException(\"The deployment contains process definitions with the same key '\" + processDefinition.getKey() + \"' (process id attribute), this is not allowed\");\n            }\n            keyList.add(processDefinition.getKey());\n        }\n\n        CommandContext commandContext = Context.getCommandContext();\n        ProcessDefinitionEntityManager processDefinitionManager = commandContext.getProcessDefinitionEntityManager();\n        DbSqlSession dbSqlSession = commandContext.getSession(DbSqlSession.class);\n        for (ProcessDefinitionEntity processDefinition : processDefinitions) {\n            List<TimerJobEntity> timers = new ArrayList<>();\n            if (deployment.isNew()) {\n                int processDefinitionVersion;\n\n                ProcessDefinitionEntity latestProcessDefinition = null;\n                if (processDefinition.getTenantId() != null && !ProcessEngineConfiguration.NO_TENANT_ID.equals(processDefinition.getTenantId())) {\n                    latestProcessDefinition = processDefinitionManager\n                            .findLatestProcessDefinitionByKeyAndTenantId(processDefinition.getKey(), processDefinition.getTenantId());\n                } else {\n                    latestProcessDefinition = processDefinitionManager","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/deployer/BpmnDeployer.java#L164-L200","documentation":"During deployment, the BpmnDeployer verifies that no two process definitions in the same deployment share the same process definition key (the 'id' attribute of the <process> element in BPMN XML). A duplicate key would violate the database unique index on ACT_RE_PROCDEF. The check runs in BpmnDeployer.deploy before persisting the definitions.","triggerScenarios":"Calling RepositoryService.createDeployment().deploy() where one deployment contains multiple BPMN XML resources whose <process id='...'> attributes are identical (e.g. two versions of a model with the same id in different files).","commonSituations":"Copying a BPMN file to create a variant and forgetting to change the process id; tooling exporting multiple diagrams all labeled with the same process id; packaging a whole folder of .bpmn files into one deployment.","solutions":["Rename the process id attribute in one of the duplicate <process> elements so each definition has a unique key","Deploy the duplicate definitions in separate deployments if they intentionally share a key","Scan the deployment resources for duplicate process ids before deploying"],"exampleFix":"<!-- before -->\n<process id=\"orderProcess\" name=\"Order\"/>\n<!-- in second file -->\n<process id=\"orderProcess\" name=\"Order V2\"/>\n<!-- after -->\n<process id=\"orderProcessV2\" name=\"Order V2\"/>","handlingStrategy":"validation","validationCode":"Set<String> keys = new HashSet<>();\nfor (String res : deploymentBuilder.getResourceNames()) {\n    if (res.endsWith(\".bpmn\") || res.endsWith(\".bpmn20.xml\")) {\n        String xml = new String(deploymentBuilder.getBytes(res), StandardCharsets.UTF_8);\n        Matcher m = Pattern.compile(\"<process[^>]*\\\\sid=\\\"([^\\\"]+)\\\"\").matcher(xml);\n        while (m.find()) {\n            if (!keys.add(m.group(1))) throw new IllegalStateException(\"Duplicate process id in deployment: \" + m.group(1));\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep one process id per BPMN file and make ids unique across the deployment folder","Add a build-time check scanning BPMN resources for duplicate process ids","Deploy variants in separate deployments if they intentionally share keys"],"tags":["deployment","bpmn","validation","duplicate-key"],"backgroundTag":"duplicate-resource-key","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"}