flowable/flowable-engine · error · FlowableObjectNotFoundException

Cannot find process instance with id

Error message

Cannot find process instance with id ${processInstanceId}

What it means

GetEntityLinkChildrenForProcessInstanceCmd validates that a process instance exists for the given id before querying entity links. When the ExecutionEntityManager's findById returns null it throws FlowableObjectNotFoundException, since entity links are only defined for an existing BPMN scope.

Solutions

  1. Check existence first with runtimeService.createProcessInstanceQuery().processInstanceId(id).singleResult().
  2. If the instance already finished, use HistoryService (historic process instance / entity link data) instead of the runtime API.
  3. Validate the id source; ensure you pass a process instance id, not an execution or task id.
  4. Confirm engine configuration points to the database that owns the instance.

Example fix

// before
runtimeService.getEntityLinkChildrenForProcessInstance(id);
// after
if (runtimeService.createProcessInstanceQuery().processInstanceId(id).count() > 0) {
    runtimeService.getEntityLinkChildrenForProcessInstance(id);
} else {
    historyService.getEntityLinkChildrenForProcessInstance(id); // finished instances
}
Defensive patterns

Strategy: validation

Validate before calling

boolean exists = runtimeService.createProcessInstanceQuery()
    .processInstanceId(processInstanceId).count() > 0;

Try / catch

try {
    runtimeService.getEntityLinkChildrenForProcessInstance(id);
} catch (FlowableObjectNotFoundException e) {
    // fall back to history service for completed instances
}

Prevention

When it happens

Trigger: Calling RuntimeService.getEntityLinkChildrenForProcessInstance(processInstanceId) with an id that matches no row in ACT_RU_EXECUTION (completed instance or wrong id).

Common situations: Querying entity links after the process instance ended and was removed; id taken from history table but executed against runtime API; multi-engine setup pointing at the wrong 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


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/89a7ca1a25a780e4. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetEntityLinkChildrenForProcessInstanceCmd.java:47

 * @author Tijs Rademakers
 */
public class GetEntityLinkChildrenForProcessInstanceCmd implements Command<List<EntityLink>>, Serializable {

    private static final long serialVersionUID = 1L;

    protected String processInstanceId;

    public GetEntityLinkChildrenForProcessInstanceCmd(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()
                .findEntityLinksByScopeIdAndType(processInstanceId, ScopeTypes.BPMN, EntityLinkType.CHILD);
    }

}

View on GitHub (pinned to d6d39ce1c6)