duplicate key value violates unique constraint "mig_cloud_site_pkey"
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
The ensuing documentation offers guidance on resolving the "mig_cloud_site_pkey" unique constraint violation error that arises during migration using Confluence Cloud Migration Assistant (CCMA).
Overview
When trying to run a Server to Cloud Migraiton using Confluence Cloud Migration Assistant (CCMA), the migration plan fails and the following message appears in atlassian-confluence.log:
caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "mig_cloud_site_pkey" Detail: Key (cloudid)=(<cloud_id_hash>) already exists.
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2476)
This issue arises if a plan has already been executed for a Cloud instance and the instance's URL has changed after that.
Solution
The issue is caused due to the bug MIG-65 - Cloud Migration Assistant fails to create a plan if a plan was already executed for a Cloud site and the site URL has changed
As a workaround, reinstall the plugin by following the page below: