Customers getting error while re-installing Connect app on a migrated instance

Our Jira app is a Connect app. Customers frequently get errors while trying to re-install our app onto an instance that they’ve imported from another cloud instance or from an on-prem Jira.

To resolve the issue, we remove the DB table row for customer’s cloud instance from the atlassian_host table in our service DB. Then they can install the app without a problem.

This happens quite a lot, especially for customers going through large scale cloud migration projects. The customer gets a cloud instance and during the course of the migration project, they perform several imports onto the same cloud instance. Every time the old instance data is overwritten, they need to install the apps again so they get this error and reach us for support.

Until today, we didn’t need to write anything to atlassian_host table. As far as I am concerned, that table is used by Connect itself and we don’t touch it.

Are we missing something? What can we do to avoid these issues? What can we do to make our app to handle this gracefully and re-install without an issue?