flowable/flowable-engine · error · FlowableObjectNotFoundException
Cannot find case instance with id
Error message
Cannot find case instance with id
What it means
GetEntityLinkParentsForCaseInstanceCmd loads the case instance before returning parent entity links referenced by this scope. If the case instance cannot be found it throws FlowableObjectNotFoundException including the id, typed to CaseInstanceEntity.class.
Source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetEntityLinkParentsForCaseInstanceCmd.java:48
* @author Javier Casal
*/
public class GetEntityLinkParentsForCaseInstanceCmd implements Command<List<EntityLink>>, Serializable {
private static final long serialVersionUID = 1L;
protected String caseInstanceId;
public GetEntityLinkParentsForCaseInstanceCmd(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()
.findEntityLinksByReferenceScopeIdAndType(caseInstanceId, ScopeTypes.CMMN, EntityLinkType.CHILD);
}
}
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Validate the id with cmmnRuntimeService.createCaseInstanceQuery().caseInstanceId(id)
- Use the correct scope id for the call (case instance id)
- Guard cleanup jobs so ids referenced by callers are not purged prematurely
Example fix
// before
List<EntityLink> parents = cmmnRuntimeService.getEntityLinkParentsForCaseInstance(caseInstanceId);
// after
if (cmmnRuntimeService.createCaseInstanceQuery().caseInstanceId(caseInstanceId).count() > 0) {
List<EntityLink> parents = cmmnRuntimeService.getEntityLinkParentsForCaseInstance(caseInstanceId);
} Defensive patterns
Strategy: validation
Validate before calling
boolean exists = cmmnRuntimeService.createCaseInstanceQuery().caseInstanceId(caseInstanceId).count() > 0;
Try / catch
try { return cmmnRuntimeService.getEntityLinkParentsForCaseInstance(id); } catch (FlowableObjectNotFoundException e) { return Collections.emptyList(); } Prevention
- Check the case instance is still running before querying parents
- Ensure cleanup jobs do not purge cases still referenced by clients
- Validate scope ids refer to case instances, not tasks or plan items
When it happens
Trigger: Calling cmmnRuntimeService.getEntityLinkParentsForCaseInstance(caseInstanceId) with an id that matches no live case instance row.
Common situations: Case instance terminated and removed; using an entity-link scope id that is not a case instance id; environment mismatch between saved id and current database.
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/abacb4ef75caa084.
Report an issue: GitHub.