flowable/flowable-engine · error · FlowableObjectNotFoundException
Cannot find case instance with id
Error message
Cannot find case instance with id
What it means
GetEntityLinkChildrenWithSameRootAsCaseInstanceCmd verifies the case instance exists before querying entity links sharing the same root scope. A missing case instance raises FlowableObjectNotFoundException with the id, typed to CaseInstanceEntity.class.
Source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetEntityLinkChildrenWithSameRootAsCaseInstanceCmd.java:45
/**
* @author Filip Hrisafov
*/
public class GetEntityLinkChildrenWithSameRootAsCaseInstanceCmd implements Command<List<EntityLink>> {
protected String caseInstanceId;
public GetEntityLinkChildrenWithSameRootAsCaseInstanceCmd(String caseInstanceId) {
this.caseInstanceId = caseInstanceId;
}
@Override
public List<EntityLink> execute(CommandContext commandContext) {
CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);
CaseInstance caseInstance = cmmnEngineConfiguration.getCaseInstanceEntityManager().findById(caseInstanceId);
if (caseInstance == null) {
throw new FlowableObjectNotFoundException("Cannot find case instance with id " + caseInstanceId, CaseInstanceEntity.class);
}
return cmmnEngineConfiguration.getEntityLinkServiceConfiguration().getEntityLinkService()
.findEntityLinksWithSameRootScopeForScopeIdAndScopeType(caseInstanceId, ScopeTypes.CMMN, EntityLinkType.CHILD);
}
}
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Check case instance existence with a CaseInstanceQuery before the call
- Confirm the id belongs to the CMMN engine and the same database
- Persist the id at case start time rather than reconstructing it
Example fix
// before
List<EntityLink> links = cmmnRuntimeService.getEntityLinkChildrenWithSameRootAsCaseInstance(id);
// after
CaseInstance ci = cmmnRuntimeService.createCaseInstanceQuery().caseInstanceId(id).singleResult();
if (ci != null) {
List<EntityLink> links = cmmnRuntimeService.getEntityLinkChildrenWithSameRootAsCaseInstance(id);
} Defensive patterns
Strategy: validation
Validate before calling
CaseInstance ci = cmmnRuntimeService.createCaseInstanceQuery().caseInstanceId(caseInstanceId).singleResult(); boolean exists = ci != null;
Try / catch
try { return cmmnRuntimeService.getEntityLinkChildrenWithSameRootAsCaseInstance(id); } catch (FlowableObjectNotFoundException e) { return Collections.emptyList(); } Prevention
- Persist the case instance id at start time and reuse it
- Use the CMMN runtime service for case-related ids
- Add existence checks in service methods wrapping engine calls
When it happens
Trigger: Calling cmmnRuntimeService.getEntityLinkChildrenWithSameRootAsCaseInstance(caseInstanceId) with an unknown, deleted, or wrong-engine id.
Common situations: Cross-referencing ids from a BPMN-only application; case data purged by history cleanup; id from 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
- Cannot find case instance with id
- Cannot find case instance with id
- No case instance found for id ${caseInstanceEntityId}
- Cannot find case instance for id ${caseInstanceId}
- Cannot find case instance with id
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/c0cd796f873a738e.
Report an issue: GitHub.