flowable/flowable-engine · error · FlowableException

The deployment contains case definitions with the same key (

Error message

The deployment contains case definitions with the same key (case id attribute), this is not allowed

What it means

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.

Source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/deployer/CmmnDeployer.java:269

    }

    protected void makeCaseDefinitionsConsistentWithPersistedVersions(CmmnParseResult parseResult) {
        for (CaseDefinitionEntity caseDefinition : parseResult.getAllCaseDefinitions()) {
            CaseDefinitionEntity persistedCaseDefinition = getPersistedInstanceOfCaseDefinition(caseDefinition);
            if (persistedCaseDefinition != null) {
                caseDefinition.setId(persistedCaseDefinition.getId());
                caseDefinition.setVersion(persistedCaseDefinition.getVersion());
                caseDefinition.setHasStartFormKey(persistedCaseDefinition.hasStartFormKey());
                caseDefinition.setHasGraphicalNotation(persistedCaseDefinition.hasGraphicalNotation());
            }
        }
    }

    protected void verifyCaseDefinitionsDoNotShareKeys(Collection<CaseDefinitionEntity> caseDefinitionEntities) {
        Set<String> keySet = new LinkedHashSet<>();
        for (CaseDefinitionEntity caseDefinitionEntity : caseDefinitionEntities) {
            if (keySet.contains(caseDefinitionEntity.getKey())) {
                throw new FlowableException("The deployment contains case definitions with the same key (case id attribute), this is not allowed");
            }
            keySet.add(caseDefinitionEntity.getKey());
        }
    }

    protected void copyDeploymentValuesToCaseDefinitions(EngineDeployment deployment, List<CaseDefinitionEntity> caseDefinitionEntities) {
        String tenantId = deployment.getTenantId();
        String deploymentId = deployment.getId();

        for (CaseDefinitionEntity caseDefinitionEntity : caseDefinitionEntities) {
            if (tenantId != null) {
                caseDefinitionEntity.setTenantId(tenantId);
            }
            caseDefinitionEntity.setDeploymentId(deploymentId);
        }
    }

    protected void setResourceNamesOnCaseDefinitions(CmmnParseResult parseResult) {

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Ensure each <case id="..."> in the deployment's resources has a unique key
  2. Rename the duplicate case id in one of the CMMN XML files and redeploy
  3. Split the resources across two deployments if they intentionally reuse keys

Example fix

// before (two files in one deployment)
<case id="creditCheck">... in creditCheck.cmmn
<case id="creditCheck">... in creditCheckV2.cmmn
// after
<case id="creditCheck"> in creditCheck.cmmn
<case id="creditCheckV2"> in creditCheckV2.cmmn
Defensive patterns

Strategy: validation

Validate before calling

Set<String> keys = caseDefinitionEntities.stream().map(CaseDefinition::getKey).collect(Collectors.toSet()); if (keys.size() < caseDefinitionEntities.size()) throw new IllegalStateException("Duplicate case keys in deployment");

Try / catch

try { repositoryService.createDeployment().addZipInputStream(zis).deploy(); } catch (FlowableException e) { if (e.getMessage().contains("same key")) { /* fix model ids */ } }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/5f90786c6d7416e2. Report an issue: GitHub.