{"record":{"id":"d123b0b9f600cc0f","repo":"flowable/flowable-engine","slug":"active-execution-could-not-be-found-with-activity","errorCode":null,"errorMessage":"Active execution could not be found with activity id ${activityId}","messagePattern":"Active execution could not be found with activity id (.+?)","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/dynamic/AbstractDynamicStateManager.java","lineNumber":328,"sourceCode":"        }\n\n        if (!processExecution.isProcessInstanceType()) {\n            throw new FlowableException(\"Execution is not a process instance type execution for id \" + processInstanceId);\n        }\n\n        if (Flowable5Util.isFlowable5ProcessDefinitionId(commandContext, processExecution.getProcessDefinitionId())) {\n            throw new FlowableException(\"Flowable 5 process definitions are not supported\");\n        }\n\n        List<ExecutionEntity> childExecutions = executionEntityManager.findChildExecutionsByProcessInstanceId(processExecution.getId());\n\n        List<ExecutionEntity> executions = childExecutions.stream()\n            .filter(e -> e.getCurrentActivityId() != null)\n            .filter(e -> e.getCurrentActivityId().equals(activityId))\n            .collect(Collectors.toList());\n\n        if (executions.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"Active execution could not be found with activity id \" + activityId);\n        }\n\n        return executions;\n    }\n\n    protected MoveExecutionEntityContainer createMoveExecutionEntityContainer(MoveActivityIdContainer activityContainer, List<ExecutionEntity> executions, CommandContext commandContext) {\n        MoveExecutionEntityContainer moveExecutionEntityContainer = new MoveExecutionEntityContainer(executions, \n                activityContainer.getMoveToActivityIds(), activityContainer.getActivityOptions());\n        if (moveExecutionEntityContainer.getActivityOptions() != null) {\n            activityContainer.setActivityOptions(moveExecutionEntityContainer.getActivityOptions());\n        }\n\n        if (activityContainer.isMoveToParentProcess()) {\n            ExecutionEntity processInstanceExecution = executions.get(0).getProcessInstance();\n            ExecutionEntity superExecution = processInstanceExecution.getSuperExecution();\n            if (superExecution == null) {\n                throw new FlowableException(\"No parent process found for execution with activity id \" + executions.get(0).getCurrentActivityId());\n            }","sourceCodeStart":310,"sourceCodeEnd":346,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/dynamic/AbstractDynamicStateManager.java#L310-L346","documentation":"After filtering the process instance's child executions by currentActivityId, none were active at the requested activity. Change-state requires at least one live execution sitting at the target source activity.","triggerScenarios":"moveActivityIdTo(fromActivityId, toActivityId) or similar where fromActivityId is not the current activity of any active execution (task already completed, activity inside a non-active subprocess, or wrong activity id).","commonSituations":"Trying to move from an activity that already finished; activity ids in subprocesses/multi-instance bodies needing scoped ids; spelling differences between BPMN XML ids and the ids passed in; async activities not yet started.","solutions":["Confirm the source activity id matches an active execution: runtimeService.createExecutionQuery().processInstanceId(id).activityId(actId).list()","Check the BPMN model id spelling (case-sensitive) for the current flow element","If the activity lives in an embedded subprocess/callActivity scope, use the proper move-operation variant or move the parent scope first"],"exampleFix":"// before\n.moveActivityIdTo(\"reviewTask\", \"approveTask\") // reviewTask already completed\n// after\nList<Execution> execs = runtimeService.createExecutionQuery().processInstanceId(piId).activityId(\"reviewTask\").list();\nif (!execs.isEmpty()) { /* changeState */ }","handlingStrategy":"validation","validationCode":"List<Execution> active = runtimeService.createExecutionQuery().processInstanceId(piId).activityId(fromActivityId).list();\nif (active.isEmpty()) throw new IllegalStateException(\"No active execution at \" + fromActivityId);","typeGuard":null,"tryCatchPattern":"try { builder.changeState(); } catch (FlowableIllegalArgumentException e) { if (e.getMessage().startsWith(\"Active execution could not be found\")) { /* correct ids or abort */ } else throw e; }","preventionTips":["Query active executions for the source activity before moving","Keep BPMN element ids stable across deployments","Beware ids inside subprocess scopes; use scope-aware move operations"],"tags":["flowable","activity","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"}