{"record":{"id":"7684cff851355d59","repo":"flowable/flowable-engine","slug":"execution-is-not-a-process-instance-type-execution","errorCode":null,"errorMessage":"Execution is not a process instance type execution for id ${processInstanceId}","messagePattern":"Execution is not a process instance type execution for id (.+?)","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/dynamic/AbstractDynamicStateManager.java","lineNumber":313,"sourceCode":"        }\n\n        if (Flowable5Util.isFlowable5ProcessDefinitionId(commandContext, execution.getProcessDefinitionId())) {\n            throw new FlowableException(\"Flowable 5 process definitions are not supported\");\n        }\n\n        return execution;\n    }\n\n    protected List<ExecutionEntity> resolveActiveExecutions(String processInstanceId, String activityId, CommandContext commandContext) {\n        ExecutionEntityManager executionEntityManager = CommandContextUtil.getExecutionEntityManager(commandContext);\n        ExecutionEntity processExecution = executionEntityManager.findById(processInstanceId);\n\n        if (processExecution == null) {\n            throw new FlowableException(\"Execution could not be found with id \" + processInstanceId);\n        }\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;","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/dynamic/AbstractDynamicStateManager.java#L295-L331","documentation":"The execution id resolved to an entity that exists but is not a process-instance-type execution (e.g. a child/concurrent execution or a sub-execution). resolveActiveExecutions requires the id to point at the root process instance execution because change-state operations are anchored on the process instance.","triggerScenarios":"Passing a child execution id, a concurrent execution id, or a sub-process-branch execution id to createChangeActivityStateBuilder().processInstanceId(...) instead of the root process instance id.","commonSituations":"Fetching an Execution from runtimeService.createExecutionQuery() and reusing one of its child execution ids; confusing execution.getId() with processInstanceId in multi-instance/parallel-gateway flows.","solutions":["Pass the root process instance id (execution with isProcessInstanceType()==true / ExecutionQuery.processInstanceId)","Resolve the parent process instance: runtimeService.createProcessInstanceQuery().processInstanceId(execution.getProcessInstanceId())","Audit id sources to guarantee the id originates from a ProcessInstance, not an Execution listing"],"exampleFix":"// before\nString id = execution.getId(); // child execution\n// after\nString id = execution.getProcessInstanceId(); // root process instance","handlingStrategy":"type-guard","validationCode":"ExecutionEntity e = (ExecutionEntity) runtimeService.createExecutionQuery().executionId(id).singleResult();\nboolean isRoot = e != null && e.isProcessInstanceType();","typeGuard":"boolean isProcessInstanceRoot(Execution e) { return e instanceof ExecutionEntity && ((ExecutionEntity) e).isProcessInstanceType(); }","tryCatchPattern":null,"preventionTips":["Use getProcessInstanceId() on child executions before calling change-state","Never pass ids from createExecutionQuery child rows directly as processInstanceId","Centralize change-state entry points to normalize ids to the root instance"],"tags":["flowable","execution","invalid-argument"],"backgroundTag":"invalid-argument-value","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"}