Hi Ivan. I was able to take the text "remote_agents_device_id_key" from the error you are seeing and then did a little searching through the Tableau internal Postgres database and found the following.
There's a unique key that exists on table remote_agents.
The description for remote_agents appears to apply only to Tableau Online. When I looked at the data within my deployment (on-premise), the table is empty.
One possible option is to login as an admin to the internal postgres and do a truncate of this table and then apply your site imports. But, I'm not really sure of all the ramifications. It would need to be tested out, or you could open a case with Tableau Support.
Thanks a lot Jeff, deleting all records worked like a charm.
After deleting all records in remote_agents table and importing site for the second time, the table is repopulated with the same values.
So I assume this is some rare unaccounted behaviour. Hope Tableau can address that.