flowable/flowable-engine · error · ActivitiException
The deployment contains process definitions with the same ke
Error message
The deployment contains process definitions with the same key '%s' (process id attribute), this is not allowed
What it means
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.
Source
Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/deployer/BpmnDeployer.java:182
} catch (Throwable t) { // if anything goes wrong, we don't store the image (the process will still be executable).
LOGGER.warn("Error while generating process diagram, image will not be stored in repository", t);
}
}
}
processDefinition.setDiagramResourceName(diagramResourceName);
processDefinition.setEngineVersion("v5");
processDefinitions.add(processDefinition);
bpmnModelMap.put(processDefinition.getKey(), bpmnParse.getBpmnModel());
}
}
}
// check if there are process definitions with the same process key to prevent database unique index violation
List<String> keyList = new ArrayList<>();
for (ProcessDefinitionEntity processDefinition : processDefinitions) {
if (keyList.contains(processDefinition.getKey())) {
throw new ActivitiException("The deployment contains process definitions with the same key '" + processDefinition.getKey() + "' (process id attribute), this is not allowed");
}
keyList.add(processDefinition.getKey());
}
CommandContext commandContext = Context.getCommandContext();
ProcessDefinitionEntityManager processDefinitionManager = commandContext.getProcessDefinitionEntityManager();
DbSqlSession dbSqlSession = commandContext.getSession(DbSqlSession.class);
for (ProcessDefinitionEntity processDefinition : processDefinitions) {
List<TimerJobEntity> timers = new ArrayList<>();
if (deployment.isNew()) {
int processDefinitionVersion;
ProcessDefinitionEntity latestProcessDefinition = null;
if (processDefinition.getTenantId() != null && !ProcessEngineConfiguration.NO_TENANT_ID.equals(processDefinition.getTenantId())) {
latestProcessDefinition = processDefinitionManager
.findLatestProcessDefinitionByKeyAndTenantId(processDefinition.getKey(), processDefinition.getTenantId());
} else {
latestProcessDefinition = processDefinitionManagerView on GitHub (pinned to d6d39ce1c6)
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
Example fix
<!-- before --> <process id="orderProcess" name="Order"/> <!-- in second file --> <process id="orderProcess" name="Order V2"/> <!-- after --> <process id="orderProcessV2" name="Order V2"/>
Defensive patterns
Strategy: validation
Validate before calling
Set<String> keys = new HashSet<>();
for (String res : deploymentBuilder.getResourceNames()) {
if (res.endsWith(".bpmn") || res.endsWith(".bpmn20.xml")) {
String xml = new String(deploymentBuilder.getBytes(res), StandardCharsets.UTF_8);
Matcher m = Pattern.compile("<process[^>]*\\sid=\"([^\"]+)\"").matcher(xml);
while (m.find()) {
if (!keys.add(m.group(1))) throw new IllegalStateException("Duplicate process id in deployment: " + m.group(1));
}
}
} Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- The deployment contains case definitions with the same key (
- The deployment contains decisions with the same key (decisio
- The deployment contains process definitions with the same ke
- EventRegistryEventDefinition on '" + elementId + "' has an e
- Errors while parsing: ${errorBuilder}
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/95d53e09ebd92353.
Report an issue: GitHub.