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}'. What it means
Thrown by MybatisCaseDefinitionDataManager.findCaseDefinitionByKeyAndVersion when the database query returns more than one case definition with the same key and version. The engine expects (key, version) to be unique across tenants and throws instead of guessing which row to return.
Source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/persistence/entity/data/impl/MybatisCaseDefinitionDataManager.java:108
@Override
public CaseDefinitionEntity findCaseDefinitionByParentDeploymentAndKeyAndTenantId(String parentDeploymentId, String caseDefinitionKey, String tenantId) {
Map<String, Object> parameters = new HashMap<>();
parameters.put("parentDeploymentId", parentDeploymentId);
parameters.put("caseDefinitionKey", caseDefinitionKey);
parameters.put("tenantId", tenantId);
return (CaseDefinitionEntity) getDbSqlSession().selectOne("selectCaseDefinitionByParentDeploymentAndKeyAndTenantId", parameters);
}
@Override
public CaseDefinitionEntity findCaseDefinitionByKeyAndVersion(String caseDefinitionKey, Integer caseDefinitionVersion) {
Map<String, Object> params = new HashMap<>();
params.put("caseDefinitionKey", caseDefinitionKey);
params.put("caseDefinitionVersion", caseDefinitionVersion);
List<CaseDefinitionEntity> results = getDbSqlSession().selectList("selectCaseDefinitionsByKeyAndVersion", 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 + "'.");
}
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 + "'.");View on GitHub (pinned to d6d39ce1c6)
Solutions
- Use findCaseDefinitionByKeyAndVersionAndTenantId(key, version, tenantId) instead so the tenant narrows the result to one row
- Delete or merge the duplicate rows so key+version is unique
- Re-run the affected deployments with unique keys or versions
Example fix
// before
CaseDefinition cd = caseDefinitionEntityManager.findCaseDefinitionByKeyAndVersion("orderFlow", 3);
// after
CaseDefinition cd = caseDefinitionEntityManager.findCaseDefinitionByKeyAndVersionAndTenantId("orderFlow", 3, "tenantA"); Defensive patterns
Strategy: try-catch
Try / catch
try {
return dataManager.findCaseDefinitionByKeyAndVersion(key, version);
} catch (FlowableException e) {
// fall back to tenant-scoped lookup or log duplicates
} Prevention
- In multi-tenant setups always use the tenant-scoped lookup
- Monitor for duplicate keys in ACT_CMMN_CASEDEF
- Never insert definition rows manually outside the deployment API
When it happens
Trigger: Calling findCaseDefinitionByKeyAndVersion(key, version) when multiple rows exist for that key/version pair, typically because the same definition was deployed twice into different tenants and no tenant was specified.
Common situations: Multi-tenant deployments with duplicate keys; manual database manipulation or migrations that duplicated rows; a data repair gone wrong leaving inconsistent definitions.
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/6b3690241ff159f6.
Report an issue: GitHub.