flowable/flowable-engine · error · FlowableObjectNotFoundException
Cannot find case definition with id
Error message
Cannot find case definition with id
What it means
AddIdentityLinkForCaseDefinitionCmd looks up the case definition by id and throws FlowableObjectNotFoundException (with CaseDefinition.class as the object type) when the entity manager returns null — i.e. no case definition with that id exists in the CMMN repository.
Source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/AddIdentityLinkForCaseDefinitionCmd.java:67
this.cmmnEngineConfiguration = cmmnEngineConfiguration;
}
protected void validateParams(String userId, String groupId, String caseDefinitionId) {
if (caseDefinitionId == null) {
throw new FlowableIllegalArgumentException("caseDefinitionId is null");
}
if (userId == null && groupId == null) {
throw new FlowableIllegalArgumentException("userId and groupId cannot both be null");
}
}
@Override
public Void execute(CommandContext commandContext) {
CaseDefinitionEntity caseDefinition = cmmnEngineConfiguration.getCaseDefinitionEntityManager().findById(caseDefinitionId);
if (caseDefinition == null) {
throw new FlowableObjectNotFoundException("Cannot find case definition with id " + caseDefinitionId, CaseDefinition.class);
}
IdentityLinkEntity identityLinkEntity = cmmnEngineConfiguration.getIdentityLinkServiceConfiguration().getIdentityLinkService()
.createScopeDefinitionIdentityLink(caseDefinition.getId(), ScopeTypes.CMMN, userId, groupId);
caseDefinition.getIdentityLinks().add(identityLinkEntity);
return null;
}
}
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Verify the id exists via cmmnRepositoryService.createCaseDefinitionQuery().caseDefinitionId(id).singleResult() before linking
- Re-query the latest deployed definition by key instead of persisting an id across environments
- Check engine/tenant configuration — ensure you query the same CMMN engine the definition was deployed to
Example fix
// before
repositoryService.addIdentityLink(caseDefinitionId, userId, null, IdentityLinkType.CANDIDATE);
// after
CaseDefinition def = repositoryService.createCaseDefinitionQuery()
.caseDefinitionId(caseDefinitionId).singleResult();
if (def == null) throw new IllegalStateException("Unknown case definition: " + caseDefinitionId);
repositoryService.addIdentityLink(def.getId(), userId, null, IdentityLinkType.CANDIDATE); Defensive patterns
Strategy: try-catch
Validate before calling
CaseDefinition def = repositoryService.createCaseDefinitionQuery()
.caseDefinitionId(caseDefinitionId).singleResult();
if (def == null) throw new IllegalStateException("Unknown case definition: " + caseDefinitionId); Try / catch
try {
repositoryService.addIdentityLink(defId, userId, groupId, type);
} catch (FlowableObjectNotFoundException e) {
log.error("Case definition {} not found (wrong env/deleted?)", defId, e);
} Prevention
- Verify existence with a CaseDefinitionQuery before mutating
- Re-resolve ids by key/latest version per environment instead of hardcoding
- Confirm same engine, database and tenant as the deployment
When it happens
Trigger: Calling cmmnRepositoryService.addIdentityLink(...) with a caseDefinitionId that was never deployed, was deleted, belongs to a different engine/database, or has a typo/wrong case.
Common situations: Referencing a definition id from another environment (test vs prod DB), id captured before redeployment replaced the definition, tenant mismatch so the query filters it out, or using a process-definition id on the CMMN engine.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- No case definition found for key '${caseDefinitionKey}'
- No case definition found for key '${caseDefinitionKey}'. Fal
- Case definition with key '${caseDefinitionKey}' and tenantId
- No deployed case definition found for key '${caseDefinitionK
- No deployed case definition found for id '${caseDefinitionId
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/c882335b686407df.
Report an issue: GitHub.