flowable/flowable-engine · error · FlowableException
There are ${results.size} case definitions with key = '${cas
Error message
There are ${results.size} case definitions with key = '${caseDefinitionKey}' and version = '${caseDefinitionVersion}' in tenant = '${tenantId}'. What it means
Thrown by MybatisCaseDefinitionDataManager.findCaseDefinitionByKeyAndVersionAndTenantId when more than one case definition matches the given key, version and tenantId. The lookup must resolve to exactly one row, so duplicates within a tenant are treated as an integrity error.
Source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/data/impl/MybatisCaseDefinitionDataManager.java:124
return results.get(0);
} else if (results.size() > 1) {
throw new FlowableException("There are " + results.size() + " case definitions with key = '" + caseDefinitionKey + "' and version = '" + caseDefinitionVersion + "'.");
}
return null;
}
@Override
@SuppressWarnings("unchecked")
public CaseDefinitionEntity findCaseDefinitionByKeyAndVersionAndTenantId(String caseDefinitionKey, Integer caseDefinitionVersion, String tenantId) {
Map<String, Object> params = new HashMap<>();
params.put("caseDefinitionKey", caseDefinitionKey);
params.put("caseDefinitionVersion", caseDefinitionVersion);
params.put("tenantId", tenantId);
List<CaseDefinitionEntity> results = getDbSqlSession().selectList("selectCaseDefinitionsByKeyAndVersionAndTenantId", params);
if (results.size() == 1) {
return results.get(0);
} else if (results.size() > 1) {
throw new FlowableException(
"There are " + results.size() + " case definitions with key = '" + caseDefinitionKey + "' and version = '" + caseDefinitionVersion
+ "' in tenant = '" + tenantId + "'.");
}
return null;
}
@Override
public void updateCaseDefinitionTenantIdForDeployment(String deploymentId, String newTenantId) {
HashMap<String, Object> params = new HashMap<>();
params.put("deploymentId", deploymentId);
params.put("tenantId", newTenantId);
getDbSqlSession().directUpdate("updateCaseDefinitionTenantIdForDeploymentId", params);
}
@Override
@SuppressWarnings("unchecked")
public List<CaseDefinition> findCaseDefinitionsByQueryCriteria(CaseDefinitionQueryImpl caseDefinitionQuery) {
setSafeInValueLists(caseDefinitionQuery);View on GitHub (pinned to d6d39ce1c6)
Solutions
- Inspect the database for duplicates: SELECT * FROM ACT_CMMN_CASEDEF WHERE KEY_ = ? AND VERSION_ = ? AND TENANT_ID_ = ?
- Remove or merge duplicate rows so the combination is unique
- Redeploy the case definition correctly so a new version (not a duplicate version) is created
Example fix
// before
// DB contains two rows for (key='orderFlow', version=3, tenant='tenantA')
CaseDefinition cd = em.findCaseDefinitionByKeyAndVersionAndTenantId("orderFlow", 3, "tenantA"); // throws
// after
DELETE FROM ACT_CMMN_CASEDEF WHERE ID_ = 'duplicateRowId';
CaseDefinition cd = em.findCaseDefinitionByKeyAndVersionAndTenantId("orderFlow", 3, "tenantA"); Defensive patterns
Strategy: try-catch
Try / catch
try {
return dataManager.findCaseDefinitionByKeyAndVersionAndTenantId(key, version, tenantId);
} catch (FlowableException e) {
// inspect duplicates for this tenant, clean up and retry
} Prevention
- Make deployments idempotent so re-deployments create new versions, not duplicate rows
- Audit the definitions table after database restores or migrations
- Include tenantId in all definition lookups when multi-tenant
When it happens
Trigger: Calling findCaseDefinitionByKeyAndVersionAndTenantId(key, version, tenantId) when the tenant's rows for that key/version are duplicated in the database.
Common situations: Duplicated rows after a database restore, migration script running twice, or accidental redeployment with forced same-version insertion; also seen when tenantId filtering was misconfigured in upstream code.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- There are ${results.size} case definitions with key = '${cas
- There are ${count} decisions with key = '${decisionKey}' and
- Setting variable is not supported for read only delegate exe
- Setting transient variable is not supported for read only de
- Setting localized name is not supported for read only delega
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/fef80db394bf3cc9.
Report an issue: GitHub.