flowable/flowable-engine · error · FlowableObjectNotFoundException
Cannot find case definition with id
Error message
Cannot find case definition with id
What it means
DeleteIdentityLinkForCaseDefinitionCmd.execute throws FlowableObjectNotFoundException when the CaseDefinitionEntityManager finds no case definition for the given caseDefinitionId. The id passed validation (non-null) but no deployed case definition with that id exists in the database.
Source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/DeleteIdentityLinkForCaseDefinitionCmd.java:64
}
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) {
CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);
CaseDefinitionEntity caseDefinition = cmmnEngineConfiguration.getCaseDefinitionEntityManager().findById(caseDefinitionId);
if (caseDefinition == null) {
throw new FlowableObjectNotFoundException("Cannot find case definition with id " + caseDefinitionId, CaseDefinition.class);
}
cmmnEngineConfiguration.getIdentityLinkServiceConfiguration().getIdentityLinkService()
.deleteScopeDefinitionIdentityLink(caseDefinition.getId(), ScopeTypes.CMMN, userId, groupId);
return null;
}
}
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Resolve the current id via repositoryService.createCaseDefinitionQuery().caseDefinitionKey(key).latestVersion().singleResult().getId() instead of hardcoding the id.
- Check the definition still exists (e.g. query first) and handle FlowableObjectNotFoundException gracefully.
- Confirm the call runs against the same database/datasource the definition was deployed to.
Example fix
// before
repositoryService.deleteGroupIdentityLinkForCaseDefinition("myCaseDef", "sales", "candidate");
// after
CaseDefinition def = repositoryService.createCaseDefinitionQuery().caseDefinitionKey("myCaseDef").latestVersion().singleResult();
if (def != null) {
repositoryService.deleteGroupIdentityLinkForCaseDefinition(def.getId(), "sales", "candidate");
} Defensive patterns
Strategy: validation
Validate before calling
CaseDefinition def = repositoryService.createCaseDefinitionQuery().caseDefinitionId(caseDefinitionId).singleResult(); if (def != null) repositoryService.deleteGroupIdentityLinkForCaseDefinition(caseDefinitionId, groupId, type);
Try / catch
try { repositoryService.deleteGroupIdentityLinkForCaseDefinition(defId, groupId, type); } catch (FlowableObjectNotFoundException e) { log.warn("Case definition {} not found", defId); } Prevention
- Look up the definition id by key + latestVersion at runtime instead of hardcoding.
- Re-resolve ids after redeployments or repository cleanups.
- Ensure the same database is used for deploy and delete.
When it happens
Trigger: Calling deleteUserIdentityLink/deleteGroupIdentityLinkForCaseDefinition with an id from another deployment, a deleted definition, or an id that is actually a key/deployment id rather than the definition id.
Common situations: After redeploying or cleaning up the repository, stale ids in scripts/config no longer resolve; mixing up case definition KEY with its generated ID; running cleanup against a different database/schema.
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 historic task instance found with id:
- Cannot find case definition for id:
- Cannot find case definition for id:
- No case definition found for id = '
- Cannot find the case definition to migrate to, identified by
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/316f09efa149e6fe.
Report an issue: GitHub.