{"record":{"id":"1659cfd4765e08e6","repo":"flowable/flowable-engine","slug":"no-parent-process-found-for-execution-with-activit","errorCode":null,"errorMessage":"No parent process found for execution with activity id ${activityId}","messagePattern":"No parent process found for execution with activity id (.+?)","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/dynamic/AbstractDynamicStateManager.java","lineNumber":345,"sourceCode":"        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            }\n\n            moveExecutionEntityContainer.setMoveToParentProcess(true);\n            moveExecutionEntityContainer.setSuperExecution(superExecution);\n\n        } else if (activityContainer.isMoveToSubProcessInstance()) {\n            moveExecutionEntityContainer.setMoveToSubProcessInstance(true);\n            moveExecutionEntityContainer.setCallActivityId(activityContainer.getCallActivityId());\n            moveExecutionEntityContainer.setCallActivitySubProcessVersion(activityContainer.getCallActivitySubProcessVersion());\n        }\n        return moveExecutionEntityContainer;\n    }\n\n    protected void prepareMoveExecutionEntityContainer(MoveExecutionEntityContainer moveExecutionContainer, ProcessDefinition migrateToProcessDefinition, CommandContext commandContext) {\n        ExpressionManager expressionManager = CommandContextUtil.getProcessEngineConfiguration(commandContext).getExpressionManager();\n\n        BpmnModel bpmnModelToMigrateTo = null;\n        if (migrateToProcessDefinition != null) {","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/dynamic/AbstractDynamicStateManager.java#L327-L363","documentation":"When the move operation requests moveToParentProcess (move out to the parent process of a callActivity instance), the code resolves the current process instance's superExecution. If it is null, the process instance is not a subprocess instance of a call activity, so there is no parent process to move to.","triggerScenarios":"Calling moveActivityIdToParentProcess() (or equivalent container flag) on a top-level process instance that was not started via a callActivity, or whose parent callActivity execution already terminated.","commonSituations":"Misusing moveToParentProcess on a root process instance; attempting the move after the parent callActivity scope was already left or terminated; wrong process instance (not the child of the call activity).","solutions":["Only use moveToParentProcess on process instances spawned by a callActivity; verify execution.getSuperExecution() exists first","If you intended a plain move within the same process, use moveActivityIdTo instead","If the parent scope already ended, restart the desired parent process instance instead of moving"],"exampleFix":"// before\n.moveActivityIdToParentProcess(\"childTask\"); // root instance\n// after\nif (execution.getSuperExecution() != null) {\n    builder.moveActivityIdToParentProcess(\"childTask\");\n} else {\n    builder.moveActivityIdTo(\"childTask\", \"nextTask\");\n}","handlingStrategy":"validation","validationCode":"Execution exec = runtimeService.createExecutionQuery().processInstanceId(piId).singleResult();\nboolean hasParent = exec != null && ((ExecutionEntity) exec).getSuperExecution() != null;","typeGuard":null,"tryCatchPattern":"try { builder.changeState(); } catch (FlowableException e) { if (e.getMessage().startsWith(\"No parent process found\")) { /* use same-process move instead */ } else throw e; }","preventionTips":["Only call moveToParentProcess for instances created by a callActivity","Verify superExecution existence first","Prefer moveActivityIdTo for intra-process moves"],"tags":["flowable","callactivity","invalid-state"],"backgroundTag":"invalid-state-transition","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"}