{"record":{"id":"89a7ca1a25a780e4","repo":"flowable/flowable-engine","slug":"cannot-find-process-instance-with-id-processinst-89a7ca","errorCode":null,"errorMessage":"Cannot find process instance with id ${processInstanceId}","messagePattern":"Cannot find process instance with id (.+?)","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetEntityLinkChildrenForProcessInstanceCmd.java","lineNumber":47,"sourceCode":" * @author Tijs Rademakers\n */\npublic class GetEntityLinkChildrenForProcessInstanceCmd implements Command<List<EntityLink>>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n\n    protected String processInstanceId;\n\n    public GetEntityLinkChildrenForProcessInstanceCmd(String processInstanceId) {\n        this.processInstanceId = processInstanceId;\n    }\n\n    @Override\n    public List<EntityLink> execute(CommandContext commandContext) {\n        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);\n        ExecutionEntity processInstance = processEngineConfiguration.getExecutionEntityManager().findById(processInstanceId);\n\n        if (processInstance == null) {\n            throw new FlowableObjectNotFoundException(\"Cannot find process instance with id \" + processInstanceId, ExecutionEntity.class);\n        }\n\n        return processEngineConfiguration.getEntityLinkServiceConfiguration().getEntityLinkService()\n                .findEntityLinksByScopeIdAndType(processInstanceId, ScopeTypes.BPMN, EntityLinkType.CHILD);\n    }\n\n}\n","sourceCodeStart":29,"sourceCodeEnd":55,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetEntityLinkChildrenForProcessInstanceCmd.java#L29-L55","documentation":"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.","triggerScenarios":"Calling RuntimeService.getEntityLinkChildrenForProcessInstance(processInstanceId) with an id that matches no row in ACT_RU_EXECUTION (completed instance or wrong id).","commonSituations":"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.","solutions":["Check existence first with runtimeService.createProcessInstanceQuery().processInstanceId(id).singleResult().","If the instance already finished, use HistoryService (historic process instance / entity link data) instead of the runtime API.","Validate the id source; ensure you pass a process instance id, not an execution or task id.","Confirm engine configuration points to the database that owns the instance."],"exampleFix":"// before\nruntimeService.getEntityLinkChildrenForProcessInstance(id);\n// after\nif (runtimeService.createProcessInstanceQuery().processInstanceId(id).count() > 0) {\n    runtimeService.getEntityLinkChildrenForProcessInstance(id);\n} else {\n    historyService.getEntityLinkChildrenForProcessInstance(id); // finished instances\n}","handlingStrategy":"validation","validationCode":"boolean exists = runtimeService.createProcessInstanceQuery()\n    .processInstanceId(processInstanceId).count() > 0;","typeGuard":null,"tryCatchPattern":"try {\n    runtimeService.getEntityLinkChildrenForProcessInstance(id);\n} catch (FlowableObjectNotFoundException e) {\n    // fall back to history service for completed instances\n}","preventionTips":["Check instance liveness before runtime entity-link queries","Use history APIs for ended instances","Validate id type (process instance, not execution/task)","Pin one datasource per engine"],"tags":["flowable","entity-link","process-instance","not-found"],"backgroundTag":"entity-not-found","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}