# Cannot index record found duplicated key

**URL:** <https://community.sonatype.com/t/cannot-index-record-found-duplicated-key/5241>\
**Category:** Sonatype Nexus Repository\
**Created:** [October 29, 2020, 10:15am UTC](https://community.sonatype.com/t/cannot-index-record-found-duplicated-key/5241 "2020-10-29T10:15:15Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![martin.cassidy](https://avatars.discourse-cdn.com/v4/letter/m/c67d28/32.png) [@martin.cassidy](https://community.sonatype.com/u/martin.cassidy)\
**Post date:** [October 29, 2020, 10:15am UTC](https://community.sonatype.com/t/cannot-index-record-found-duplicated-key/5241/1 "2020-10-29T10:15:15Z")

</div>

Hi,

I’m getting a series of errors when repositories are indexing  
Cannot index record [#23](https://support.sonatype.com/hc/requests/23):536515: found duplicated key, and many other records as well.

I’ve tried to repair/rebuild the index using the orient db console tool, but get the same error there as well.

Not sure if I can just delete the duplicate or not

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![d.j.mansukhani](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@d.j.mansukhani](https://community.sonatype.com/u/d.j.mansukhani)\
**Post date:** [November 6, 2020, 3:50pm UTC](https://community.sonatype.com/t/cannot-index-record-found-duplicated-key/5241/2 "2020-11-06T15:50:36Z")

</div>

> [@martin.cassidy](#):
>
> Cannot index record [#23](https://support.sonatype.com/hc/requests/23):536515: found duplicated key

Hi,

try dropping the index or delete the index and create again  
see if this work

Thanks  
DJM

---

<div class="post-metadata">

**Author:** ![martin.cassidy](https://avatars.discourse-cdn.com/v4/letter/m/c67d28/32.png) [@martin.cassidy](https://community.sonatype.com/u/martin.cassidy)\
**Post date:** [August 3, 2021, 2:25pm UTC](https://community.sonatype.com/t/cannot-index-record-found-duplicated-key/5241/3 "2021-08-03T14:25:35Z")

</div>

Deleting the index didn’t help. When I created it again, I got exactly the same error. I had to truncate browse\_node to be able to create the index again.

Upon restarting nexus though, when it starts to run all its internal indexing I’m seeing a lot of

2021-08-03 15:21:00,622+0100 WARN [quartz-3-thread-11] \*SYSTEM org.sonatype.nexus.repository.browse.internal.BrowseNodeManager - Problem generating browse nodes for Asset{metadata=AttachedEntityMetadata{schema=asset, document=#20:857684{bucket:#16:1,format:maven2,last\_updated:Wed Jul 31 10:19:20 BST 2019,attributes:[5],component:null,name:com/fasterxml/jackson/dataformat/jackson-dataformat-xml/maven-metadata.xml.md5,size:32,content\_type:text/plain,created\_by:anonymous,created\_by\_ip:10.4.6.41,blob\_ref:default@FA7D0C3D-91F6966F-CF38671D-50407B63-61CD00C0:6f2a4ecc-2c5e-43e9-a315-4fdb6ec06be0,last\_downloaded:null,blob\_created:Tue Jul 30 10:35:57 BST 2019,blob\_updated:Tue Jul 30 10:35:57 BST 2019} v2}, name=com/fasterxml/jackson/dataformat/jackson-dataformat-xml/maven-metadata.xml.md5}  
com.orientechnologies.orient.core.storage.ORecordDuplicatedException: Cannot index record #24:867217: found duplicated key ‘#20:857684’ in index ‘browse\_node\_asset\_id\_idx’ previously assigned to the record #23:56359  
DB name=“component”

(240 and counting)

I assume that nexus is actually filling browse\_node with duplicate date for some reason.

---

<div class="post-metadata">

**Author:** ![mpiggott](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@mpiggott](https://community.sonatype.com/u/mpiggott)\
**Post date:** [August 3, 2021, 4:52pm UTC](https://community.sonatype.com/t/cannot-index-record-found-duplicated-key/5241/4 "2021-08-03T16:52:15Z")

</div>

I would hazard the table(s) browse nodes is built from are corrupted and have duplicate identifiers.

---

<div class="post-metadata">

**Author:** ![martin.cassidy](https://avatars.discourse-cdn.com/v4/letter/m/c67d28/32.png) [@martin.cassidy](https://community.sonatype.com/u/martin.cassidy)\
**Post date:** [August 3, 2021, 5:03pm UTC](https://community.sonatype.com/t/cannot-index-record-found-duplicated-key/5241/5 "2021-08-03T17:03:14Z")

</div>

Do you know how can identify and fix this?

---

<div class="post-metadata">

**Author:** ![mpiggott](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@mpiggott](https://community.sonatype.com/u/mpiggott)\
**Post date:** [August 4, 2021, 6:04pm UTC](https://community.sonatype.com/t/cannot-index-record-found-duplicated-key/5241/6 "2021-08-04T18:04:09Z")

</div>

> [@martin.cassidy](#):
>
> Cannot index record #24:867217: found duplicated key ‘#20:857684’ in index ‘browse\_node\_asset\_id\_idx’ previously assigned to the record #23:56359

I believe this suggests that there may be two entries in the Asset table with the #20:857684 ID

---

<div class="post-metadata">

**Author:** ![martin.cassidy](https://avatars.discourse-cdn.com/v4/letter/m/c67d28/32.png) [@martin.cassidy](https://community.sonatype.com/u/martin.cassidy)\
**Post date:** [August 5, 2021, 8:24am UTC](https://community.sonatype.com/t/cannot-index-record-found-duplicated-key/5241/7 "2021-08-05T08:24:45Z")

</div>

Do you have any idea how that might have happened? Is it safe to delete duplicates from that table?

---

<div class="post-metadata">

**Author:** ![mpiggott](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@mpiggott](https://community.sonatype.com/u/mpiggott)\
**Post date:** [August 5, 2021, 4:21pm UTC](https://community.sonatype.com/t/cannot-index-record-found-duplicated-key/5241/8 "2021-08-05T16:21:26Z")

</div>

Its impossible to really know why it may have happened, common problems tend to be killing Nexus rather than stopping the service, “backing up” the database by copying files while Nexus is running, etc. This is partly why we’ve been working on enabling some [alternative database options](https://help.sonatype.com/repomanager3/new-database-options-%28preview%29).

In terms of safety, I’d suggest looking at the records to see if they appear to be for the same asset (i.e. file, it would have the same bucket and path). If they’re for the same thing then removing one should be fine (you may want to look at which one seems the newest, and remove the oldest), if they’re for different files then you may want to try to remove one and re-insert it so you don’t lose an asset.

---

<div class="post-metadata">

**Author:** ![martin.cassidy](https://avatars.discourse-cdn.com/v4/letter/m/c67d28/32.png) [@martin.cassidy](https://community.sonatype.com/u/martin.cassidy)\
**Post date:** [December 17, 2021, 4:54pm UTC](https://community.sonatype.com/t/cannot-index-record-found-duplicated-key/5241/9 "2021-12-17T16:54:53Z")

</div>

I’ve run the query  
SELECT FROM (select name,count(\*) as conteggio from asset group by bucket, name) where conteggio \> 1  
Which didn’t produce any results.

The following:  
SELECT FROM (select name,count(\*) as conteggio from asset group by name) where conteggio \> 1  
Did produce many results - all in different buckets

Is the second one correct? - you did mention buckets in your answer.

---

<div class="post-metadata">

**Author:** ![mpiggott](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@mpiggott](https://community.sonatype.com/u/mpiggott)\
**Post date:** [December 17, 2021, 6:08pm UTC](https://community.sonatype.com/t/cannot-index-record-found-duplicated-key/5241/10 "2021-12-17T18:08:41Z")

</div>

Bucket is roughly the analog for a repository in that table. Its only relevant for trying to understand what the duplicated IDs are.

If you can’t find duplicates the only thing I can really suggest is rebuilding the browse node table if you haven’t tried that already.

---

<div class="post-metadata">

**Author:** ![shavitdevops](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@shavitdevops](https://community.sonatype.com/u/shavitdevops)\
**Post date:** [December 22, 2021, 9:29am UTC](https://community.sonatype.com/t/cannot-index-record-found-duplicated-key/5241/11 "2021-12-22T09:29:30Z")

</div>

we’re having similar issues but when trying to connect to the orient db as root (nexus runs as container in vm) it messes with permissions to files, how should we connect to it and how can we delete the index and recreate it? and is it the best option?

---

<div class="post-metadata">

**Author:** ![martin.cassidy](https://avatars.discourse-cdn.com/v4/letter/m/c67d28/32.png) [@martin.cassidy](https://community.sonatype.com/u/martin.cassidy)\
**Post date:** [March 4, 2022, 5:50pm UTC](https://community.sonatype.com/t/cannot-index-record-found-duplicated-key/5241/12 "2022-03-04T17:50:18Z")

</div>

How would I go about rebuilding the browse node table?

---

<div class="post-metadata">

**Author:** ![dsawa](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/dsawa/32/729_2.png) [@dsawa](https://community.sonatype.com/u/dsawa)\
**Post date:** [March 4, 2022, 5:56pm UTC](https://community.sonatype.com/t/cannot-index-record-found-duplicated-key/5241/13 "2022-03-04T17:56:42Z")

</div>

Hi Martin,  
Go to Administration → Tasks → Create task, select _Repair - Rebuild repository browse_ and either schedule it or just run manually.
