# שגיאת ייבוא גיבוי: "לא ניתן ליצור אינדקס ייחודי"

**URL:** <https://meta.discourse.org/t/error-importing-backup-could-not-create-unique-index/207766>\
**Category:** Self-hosting\
**Created:** [31 באוקטובר,‏ 2021,‏ 8:48pm UTC](https://meta.discourse.org/t/error-importing-backup-could-not-create-unique-index/207766 "2021-10-31T20:48:45Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![glynhudson](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/glynhudson/32/120597_2.png) [@glynhudson](https://meta.discourse.org/u/glynhudson)\
**Post date:** [31 באוקטובר,‏ 2021,‏ 8:48pm UTC](https://meta.discourse.org/t/error-importing-backup-could-not-create-unique-index/207766/1 "2021-10-31T20:48:45Z")

</div>

Hi,

I’m attempting to migrate a forum to a new server. Both servers are running the latest version of discourse docker. When importing the backup via command line, I get the following error:

```plaintext
ERROR: could not create unique index "index_incoming_referers_on_path_and_incoming_domain_id"
DETAIL: Key (path, incoming_domain_id)=(/search/, 418) is duplicated.
EXCEPTION: psql failed: DETAIL: Key (path, incoming_domain_id)=(/search/, 418) is duplicated.

```

This seems to the same or similar error as:

> [@Restore fails - could not create unique index](https://meta.discourse.org/t/restore-fails-could-not-create-unique-index/151380/9):
>
> I have a duplicate key issue also, is there a documented fix? discourse=# REINDEX SCHEMA CONCURRENTLY public; ERROR: could not create unique index "index\_incoming\_referers\_on\_path\_and\_incoming\_domain\_id\_ccnew" DETAIL: Key (path, incoming\_domain\_id)=(/search/, 1905) is duplicated. [1] pry(main)\> IncomingReferer.where(path: "/m/search") =\> [#\<IncomingReferer:0x0000557176d3f210 id: 44231, path: "/m/search", incoming\_domain\_id: 4\>, #\<IncomingReferer:0x0000557176d925c8 id: 42228, path: "/m/…

However, in my case the duplicated records are in the `/search/` path rather than `/m/search` as is the case on the thread linked above.

I’ve connected to the container on the old server (`./launcher enter app`) and in the Rails console (`rails c`) I’ve tried to search for the duplicated records using:

`IncomingReferer.where(path: "/search")`  
and  
`IncomingReferer.where("path LIKE '%/search%'")`

However, this results in 100’s of records being displayed. How can I work out what records are duplicated, and how can I safely delete these and rebuild? The forum is currently working fine on the old server, we just need to move to new hardware.

---

_[View the full topic](https://meta.discourse.org/t/error-importing-backup-could-not-create-unique-index/207766)._
