{"record":{"id":"113dfeff9942e112","repo":"flowable/flowable-engine","slug":"cannot-find-process-instance-with-id-processinst-113dfe","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/GetEntityLinkChildrenWithSameRootAsProcessInstanceCmd.java","lineNumber":44,"sourceCode":"\n/**\n * @author Filip Hrisafov\n */\npublic class GetEntityLinkChildrenWithSameRootAsProcessInstanceCmd implements Command<List<EntityLink>> {\n\n    protected String processInstanceId;\n\n    public GetEntityLinkChildrenWithSameRootAsProcessInstanceCmd(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                .findEntityLinksWithSameRootScopeForScopeIdAndScopeType(processInstanceId, ScopeTypes.BPMN, EntityLinkType.CHILD);\n    }\n\n}\n","sourceCodeStart":26,"sourceCodeEnd":52,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetEntityLinkChildrenWithSameRootAsProcessInstanceCmd.java#L26-L52","documentation":"GetEntityLinkChildrenWithSameRootAsProcessInstanceCmd first verifies the process instance exists via ExecutionEntityManager.findById. A null lookup triggers FlowableObjectNotFoundException because same-root entity link queries require a live BPMN process instance as the scope.","triggerScenarios":"Calling RuntimeService.getEntityLinkChildrenForProcessInstanceWithSameRootAs(processInstanceId) (this command) with an unknown or already-completed process instance id.","commonSituations":"Instance completed and cleaned before the query; copy/paste of ids across environments; using the task id or execution id instead of the process instance id; wrong tenant/engine datasource.","solutions":["Confirm the instance is still running via runtimeService.createProcessInstanceQuery().processInstanceId(id).count() before the call.","For completed instances, switch to history-based entity link retrieval via HistoryService.","Verify the id is a process instance id (not an execution or case id).","Check datasource/engine configuration for multi-deployment setups."],"exampleFix":"// before\nruntimeService.getEntityLinkChildrenForProcessInstanceWithSameRootAs(pid);\n// after\nProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(pid).singleResult();\nif (pi != null) {\n    runtimeService.getEntityLinkChildrenForProcessInstanceWithSameRootAs(pid);\n}","handlingStrategy":"validation","validationCode":"boolean exists = runtimeService.createProcessInstanceQuery()\n    .processInstanceId(processInstanceId).count() > 0;","typeGuard":null,"tryCatchPattern":"try {\n    runtimeService.getEntityLinkChildrenForProcessInstanceWithSameRootAs(id);\n} catch (FlowableObjectNotFoundException e) {\n    // instance gone: use history data\n}","preventionTips":["Guard with a process instance query first","Switch to history for finished instances","Ensure id is the process instance id","Verify environment/database alignment"],"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"}