flowable/flowable-engine · error · FlowableObjectNotFoundException
Cannot find process instance with id
Error message
Cannot find process instance with id ${processInstanceId} What it means
GetEntityLinkParentsForProcessInstanceCmd looks up the process instance and throws FlowableObjectNotFoundException if findById returns null. Parent entity links can only be resolved from an existing BPMN process instance scope.
Solutions
- Guard the call with runtimeService.createProcessInstanceQuery().processInstanceId(id).singleResult() != null.
- Use history entity-link queries once the process instance has completed.
- Double-check you are passing the root process instance id, not a child execution id.
- Verify engine/database configuration matches where the instance was started.
Example fix
// before
runtimeService.getEntityLinkParentsForProcessInstance(pid);
// after
if (runtimeService.createProcessInstanceQuery().processInstanceId(pid).count() > 0) {
runtimeService.getEntityLinkParentsForProcessInstance(pid);
} Defensive patterns
Strategy: validation
Validate before calling
boolean exists = runtimeService.createProcessInstanceQuery()
.processInstanceId(processInstanceId).count() > 0; Try / catch
try {
runtimeService.getEntityLinkParentsForProcessInstance(id);
} catch (FlowableObjectNotFoundException e) {
// handle missing instance (completed or wrong id)
} Prevention
- Fetch instance ids from live query results only
- Use historic entity-link queries post-completion
- Avoid caching process instance ids long-term
- Check datasource config in multi-engine setups
When it happens
Trigger: Calling RuntimeService.getEntityLinkParentsForProcessInstance(processInstanceId) when the id does not correspond to a live process instance execution.
Common situations: Querying after the instance ended; stale ids cached in an external app; id from a different engine database; mistyped id string.
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 process instance with id
- Cannot find process instance with id
- Cannot find process definition with id
- Cannot find process instance with id
- Cannot find process instance with id
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/1f0cd67b4e7617f1.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetEntityLinkParentsForProcessInstanceCmd.java:47
* @author Javier Casal
*/
public class GetEntityLinkParentsForProcessInstanceCmd implements Command<List<EntityLink>>, Serializable {
private static final long serialVersionUID = 1L;
protected String processInstanceId;
public GetEntityLinkParentsForProcessInstanceCmd(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
@Override
public List<EntityLink> execute(CommandContext commandContext) {
ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);
ExecutionEntity processInstance = processEngineConfiguration.getExecutionEntityManager().findById(processInstanceId);
if (processInstance == null) {
throw new FlowableObjectNotFoundException("Cannot find process instance with id " + processInstanceId, ExecutionEntity.class);
}
return processEngineConfiguration.getEntityLinkServiceConfiguration().getEntityLinkService()
.findEntityLinksByReferenceScopeIdAndType(processInstanceId, ScopeTypes.BPMN, EntityLinkType.CHILD);
}
}
View on GitHub (pinned to d6d39ce1c6)