VMs restored from backup, when configured for replication may fail with the error: "Unable to configure replication for virtual machine '###' because the virtual machine is already replicated. Cannot create group '###'. Operation ID: ########-####-###-####-###-#############".
This issue may occur while replicating a VM within the same vCenter.
This issue may also occur for VMs which were migrated from one vCenter to another using VMware HCX (Hybrid Cloud Extension).
vSphere Replication 8.x
vSphere Replication 9.x
The VM fails to be configured for replication, as the VM has stale replication entry on the source ESXi host.
This can be validated by running the command on SSH on source ESXi host:
Command to get the VM ID: vim-cmd vmsvc/getallvms | grep -i <vm_name>
Make a note of the vm_id, it would be the first column of the output.
Command to get VM replication state: vim-cmd hbrsvc/vmreplica.getState <vm_id>
vim-cmd hbrsvc/vmreplica.getState <vm_id>Retrieve VM running replication state: The VM is configured for replication. Current replication state: Group: VRID-########-####-####-####-############ (generation=###############) Group State; full sync (0% done: checksummed 0 bytes of 5.7 TB, transferred 0 bytes of 0 bytes) DiskID RDID-########-####-####-####-############ State: full sync (checksummed 0 bytes of ### GB, transferred 0 bytes of 0 bytes) DiskID RDID-########-####-####-####-############ State: full sync (checksummed 0 bytes of ### GB, transferred 0 bytes of 0 bytes) DiskID RDID-########-####-####-####-############ State: full sync (checksummed 0 bytes of ### GB, transferred 0 bytes of 0 bytes) DiskID RDID-########-####-####-####-############ State: full sync (checksummed 0 bytes of ### GB, transferred 0 bytes of 0 bytes) DiskID RDID-########-####-####-####-############ State: full sync (checksummed 0 bytes of ### GB, transferred 0 bytes of 0 bytes) DiskID RDID-########-####-####-####-############ State: full sync (checksummed 0 bytes of ### GB, transferred 0 bytes of 0 bytes) DiskID RDID-########-####-####-####-############ State: full sync (checksummed 0 bytes of ### GB, transferred 0 bytes of 0 bytes)When configuring a VM for replication, VR finds this existing replication and thus blocks creation of new replication for the VM.
To resolve this issue:
Log in to SSH of ESXi host as root, where the running VM resides.
Run this command to get the VM ID: vim-cmd vmsvc/getallvms | grep -i <vm_name>
Make a note of the vm_id, it would be the first column of the output.
Run this command to get VM replication state: vim-cmd hbrsvc/vmreplica.getState <vm_id>
Match the GID/VRID from this output and the error seen on the Graphical User Interface (GUI). If this virtual machine is not configured for replication, it is a stale entry on the ESXi host and can be safely removed.
To disable the VM's replication on the host and removing the entry, run this command: vim-cmd hbrsvc/vmreplica.disable <vm_id>
Re-attempt to configure VM for replication.