{"record":{"id":"ab3d8e181e26deb9","repo":"flowable/flowable-engine","slug":"the-current-process-definition-id-currentpro","errorCode":null,"errorMessage":"The current process definition (id = '${currentProcessDefinition.getId()}') is a v5 definition. However the new process definition (id = '${newProcessDefinition.getId()}') is not a v5 definition.","messagePattern":"The current process definition \\(id = '(.+?)'\\) is a v5 definition\\. However the new process definition \\(id = '(.+?)'\\) is not a v5 definition\\.","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SetProcessDefinitionVersionCmd.java","lineNumber":98,"sourceCode":"        // process definition that the process instance is using\n        ExecutionEntityManager executionManager = CommandContextUtil.getExecutionEntityManager(commandContext);\n        ExecutionEntity processInstance = executionManager.findById(processInstanceId);\n        if (processInstance == null) {\n            throw new FlowableObjectNotFoundException(\"No process instance found for id = '\" + processInstanceId + \"'.\", ProcessInstance.class);\n        } else if (!processInstance.isProcessInstanceType()) {\n            throw new FlowableIllegalArgumentException(\"A process instance id is required, but the provided id \" + \"'\" + processInstanceId + \"' \" + \"points to a child execution of process instance \" + \"'\"\n                    + processInstance.getProcessInstanceId() + \"'. \" + \"Please invoke the \" + getClass().getSimpleName() + \" with a root execution id.\");\n        }\n\n        DeploymentManager deploymentCache = CommandContextUtil.getProcessEngineConfiguration(commandContext).getDeploymentManager();\n        ProcessDefinition currentProcessDefinition = deploymentCache.findDeployedProcessDefinitionById(processInstance.getProcessDefinitionId());\n\n        ProcessDefinition newProcessDefinition = deploymentCache\n                .findDeployedProcessDefinitionByKeyAndVersionAndTenantId(currentProcessDefinition.getKey(), processDefinitionVersion, currentProcessDefinition.getTenantId());\n\n        if (Flowable5Util.isFlowable5ProcessDefinition(currentProcessDefinition, commandContext) && !Flowable5Util\n            .isFlowable5ProcessDefinition(newProcessDefinition, commandContext)) {\n            throw new FlowableIllegalArgumentException(\"The current process definition (id = '\" + currentProcessDefinition.getId() + \"') is a v5 definition.\"\n                + \" However the new process definition (id = '\" + newProcessDefinition.getId() + \"') is not a v5 definition.\");\n        }\n\n        validateAndSwitchVersionOfExecution(commandContext, processInstance, newProcessDefinition);\n\n        // switch the historic process instance to the new process definition version\n        CommandContextUtil.getHistoryManager(commandContext).recordProcessDefinitionChange(processInstanceId, newProcessDefinition.getId());\n\n        // switch all sub-executions of the process instance to the new process definition version\n        Collection<ExecutionEntity> childExecutions = executionManager.findChildExecutionsByProcessInstanceId(processInstanceId);\n        for (ExecutionEntity executionEntity : childExecutions) {\n            validateAndSwitchVersionOfExecution(commandContext, executionEntity, newProcessDefinition);\n        }\n\n        return null;\n    }\n\n    protected void validateAndSwitchVersionOfExecution(CommandContext commandContext, ExecutionEntity execution, ProcessDefinition newProcessDefinition) {","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SetProcessDefinitionVersionCmd.java#L80-L116","documentation":"The command refuses to migrate a Flowable 5 process instance to a non-v5 (Flowable 6) process definition, or vice versa in the mixed-engine mode. Version migration must stay within the same engine generation.","triggerScenarios":"Calling setProcessDefinitionVersion where the current definition is marked as a Flowable 5 definition (deployed via the v5 compatibility layer) and the target version resolves to a Flowable 6 definition (or the new definition key/version resolves to a different engine generation).","commonSituations":"Upgrading from Flowable 5 / Activiti to Flowable 6 while migrating running v5 instances; deploying a new definition version without the v5 compatibility flag; key collision between a v5 and v6 definition.","solutions":["Only migrate between versions of definitions of the same engine generation","Redeploy the target version with Flowable 5 compatibility enabled if the instance is a v5 instance","Complete or terminate v5 instances before switching to v6 definitions; do not use setProcessDefinitionVersion across the v5/v6 boundary"],"exampleFix":"// before\nnew SetProcessDefinitionVersionCmd(piId, 2); // current def v5, target def v6\n// after\nif (Flowable5Util.isFlowable5ProcessDefinition(currentDef, ctx) == Flowable5Util.isFlowable5ProcessDefinition(newDef, ctx)) {\n    new SetProcessDefinitionVersionCmd(piId, 2);\n}","handlingStrategy":"validation","validationCode":"boolean sameGeneration = Flowable5Util.isFlowable5ProcessDefinition(currentDef, ctx) == Flowable5Util.isFlowable5ProcessDefinition(newDef, ctx);\nif (!sameGeneration) throw new IllegalStateException(\"cannot migrate across v5/v6\");","typeGuard":null,"tryCatchPattern":"try { cmd.execute(ctx); } catch (FlowableIllegalArgumentException e) { log.error(\"v5/v6 migration not supported\", e); }","preventionTips":["Check engine generation of both definitions before migration","Pin definition keys to avoid v5/v6 key collisions","Plan v5 instances complete before engine upgrade"],"tags":["compatibility","flowable5","migration"],"backgroundTag":"unsupported-operation","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"}