# Import failing with \`could not create unique index\`

**URL:** <https://meta.discourse.org/t/import-failing-with-could-not-create-unique-index/154693>\
**Category:** Self-hosting\
**Created:** [12 juni 2020 om 19:10 UTC](https://meta.discourse.org/t/import-failing-with-could-not-create-unique-index/154693 "2020-06-12T19:10:16Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [12 juni 2020 om 19:16 UTC](https://meta.discourse.org/t/import-failing-with-could-not-create-unique-index/154693/2 "2020-06-12T19:16:18Z")

</div>

I believe the easiest path forward for you is to get a working backup and import into a new instance like you tried last.

Let’s try to fix the duplicated data:

```bash
# ssh into the machine
cd /var/discourse
./launcher enter app
su postgres
psql
\connect discourse
SELECT * FROM incoming_domains WHERE name LIKE '%homeassistant.home%';

# this should print multiple lines
# use SQL DELETE statements to fix it
# and exit with \q

```

Can you try the above and ask for more help if you get stuck?

---

_[View the full topic](https://meta.discourse.org/t/import-failing-with-could-not-create-unique-index/154693)._
