flowable/flowable-engine · error · FlowableObjectNotFoundException
Cannot find case instance with id
Error message
Cannot find case instance with id
What it means
GetEntityLinkChildrenForCaseInstanceCmd loads the case instance before reading its CHILD entity links. If no case instance exists for the given id it throws FlowableObjectNotFoundException with the id in the message, typed to CaseInstanceEntity.class.
Source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetEntityLinkChildrenForCaseInstanceCmd.java:48
* @author Tijs Rademakers
*/
public class GetEntityLinkChildrenForCaseInstanceCmd implements Command<List<EntityLink>>, Serializable {
private static final long serialVersionUID = 1L;
protected String caseInstanceId;
public GetEntityLinkChildrenForCaseInstanceCmd(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()
.findEntityLinksByScopeIdAndType(caseInstanceId, ScopeTypes.CMMN, EntityLinkType.CHILD);
}
}
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Verify the case instance exists via cmmnRuntimeService.createCaseInstanceQuery().caseInstanceId(id).singleResult() first
- Use the correct id type (case instance id, not BPMN process instance id)
- Check history tables/service if the case has already ended
Example fix
// before
List<EntityLink> links = cmmnRuntimeService.getEntityLinkChildrenForCaseInstance(caseInstanceId);
// after
if (cmmnRuntimeService.createCaseInstanceQuery().caseInstanceId(caseInstanceId).count() > 0) {
List<EntityLink> links = cmmnRuntimeService.getEntityLinkChildrenForCaseInstance(caseInstanceId);
} Defensive patterns
Strategy: validation
Validate before calling
boolean exists = cmmnRuntimeService.createCaseInstanceQuery().caseInstanceId(caseInstanceId).count() > 0;
Try / catch
try { return cmmnRuntimeService.getEntityLinkChildrenForCaseInstance(id); } catch (FlowableObjectNotFoundException e) { return Collections.emptyList(); } Prevention
- Verify case instance existence before entity-link queries
- Do not confuse BPMN process instance ids with CMMN case instance ids
- Account for history cleanup removing finished case instances
When it happens
Trigger: Calling cmmnRuntimeService.getEntityLinkChildrenForCaseInstance(caseInstanceId) with an id of a non-existent, deleted, or completed-and-removed case instance.
Common situations: Using a process instance (BPMN) id instead of a case instance id; case finished and history cleanup removed it; stale reference after rollback of the case start.
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/f05ca8cff0a0cb8e.
Report an issue: GitHub.