{"record":{"id":"74fee396157196dc","repo":"flowable/flowable-engine","slug":"execution-executionid-doesn-t-exist","errorCode":null,"errorMessage":"execution ${executionId} doesn't exist","messagePattern":"execution (.+?) doesn't exist","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/FindActiveActivityIdsCmd.java","lineNumber":52,"sourceCode":"\n    private static final long serialVersionUID = 1L;\n    protected String executionId;\n\n    public FindActiveActivityIdsCmd(String executionId) {\n        this.executionId = executionId;\n    }\n\n    @Override\n    public List<String> execute(CommandContext commandContext) {\n        if (executionId == null) {\n            throw new FlowableIllegalArgumentException(\"executionId is null\");\n        }\n\n        ExecutionEntityManager executionEntityManager = CommandContextUtil.getExecutionEntityManager(commandContext);\n        ExecutionEntity execution = executionEntityManager.findById(executionId);\n\n        if (execution == null) {\n            throw new FlowableObjectNotFoundException(\"execution \" + executionId + \" doesn't exist\", Execution.class);\n        }\n\n        return findActiveActivityIds(execution);\n    }\n\n    public List<String> findActiveActivityIds(ExecutionEntity executionEntity) {\n        List<String> activeActivityIds = new ArrayList<>();\n        collectActiveActivityIds(executionEntity, activeActivityIds);\n        return activeActivityIds;\n    }\n\n    protected void collectActiveActivityIds(ExecutionEntity executionEntity, List<String> activeActivityIds) {\n        if (executionEntity.isActive() && executionEntity.getActivityId() != null) {\n            activeActivityIds.add(executionEntity.getActivityId());\n        }\n\n        for (ExecutionEntity childExecution : executionEntity.getExecutions()) {\n            collectActiveActivityIds(childExecution, activeActivityIds);","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/FindActiveActivityIdsCmd.java#L34-L70","documentation":"When the executionId is non-null but ExecutionEntityManager.findById finds no execution, the command throws FlowableObjectNotFoundException. The id refers to an execution that never existed or no longer exists.","triggerScenarios":"runtimeService.getActiveActivityIds(id) with an id of a completed or deleted process instance, a mistyped id, or an id from a different engine database.","commonSituations":"Querying active activities after the instance finished; historical dashboards caching execution ids past their lifetime; multi-engine environments hitting the wrong datasource.","solutions":["Check existence first with runtimeService.createExecutionQuery().executionId(id).singleResult()","If the instance may have ended, fall back to historyService.createHistoricActivityInstanceQuery().executionId(id)","Verify the id and the datasource/engine you are connected to"],"exampleFix":"// before\nList<String> ids = runtimeService.getActiveActivityIds(id);\n// after\nExecution exec = runtimeService.createExecutionQuery().executionId(id).singleResult();\nList<String> ids = exec != null ? runtimeService.getActiveActivityIds(id)\n    : historyService.createHistoricActivityInstanceQuery().executionId(id).list()\n        .stream().map(HistoricActivityInstance::getActivityId).toList();","handlingStrategy":"validation","validationCode":"Execution exec = runtimeService.createExecutionQuery().executionId(id).singleResult();\nif (exec == null) throw new IllegalArgumentException(\"execution not found: \" + id);","typeGuard":"boolean isActiveExecution(String id) { return runtimeService.createExecutionQuery().executionId(id).count() > 0; }","tryCatchPattern":"try { ... } catch (FlowableObjectNotFoundException e) { if (e.getEntityClass() == Execution.class) { /* fall back to history query */ } else throw e; }","preventionTips":["Only query active activity ids for known-running instances","Fall back to HistoricActivityInstance queries for finished instances","Avoid storing execution ids long-term; store process/business keys"],"tags":["flowable","execution-not-found","stale-id"],"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-14T11:17:12.474Z"}