Duplicate key error on rebuilding index

I am encountering some problems on my orientdb concerning indexes.

The servers file system was full and somebody restarted the nexus docker container, so now my indexes are corrupt.

I was pushing a build to the nexus when someone restarted the container…

I logged on on the orientdb console, and when I try to ebuild the index i get the following error:

orientdb {db=component}> REBUILD INDEX *

Rebuilding index(es)…$ANSI{green {db=component}} Error during index rebuild
com.orientechnologies.orient.core.storage.ORecordDuplicatedException: Cannot index record #27:2092: found duplicated key ‘OCompositeKey{keys=[#24:1, null, vao/vao_base, vao_base_chrome]}’ in index ‘component_bucket_group_name_version_idx’ previously assigned to the record #25:2108
DB name=“component” INDEX=component_bucket_group_name_version_idx RID=#25:2108
at com.orientechnologies.orient.core.index.OIndexUnique$1.validate(OIndexUnique.java:47)
at com.orientechnologies.orient.core.index.OIndexUnique$1.validate(OIndexUnique.java:37)
at com.orientechnologies.orient.core.index.sbtree.local.OSBTree.put(OSBTree.java:855)
at com.orientechnologies.orient.core.index.sbtree.local.OSBTree.validatedPut(OSBTree.java:261)
at com.orientechnologies.orient.core.index.engine.OSBTreeIndexEngine.validatedPut(OSBTreeIndexEngine.java:169)
at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.doValidatedPutIndexValue(OAbstractPaginatedStorage.java:2519)
at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.validatedPutIndexValue(OAbstractPaginatedStorage.java:2498)
at com.orientechnologies.orient.core.index.OIndexUnique.put(OIndexUnique.java:82)
at com.orientechnologies.orient.core.index.OIndexUnique.put(OIndexUnique.java:35)
at com.orientechnologies.orient.core.index.OIndexAbstract.populateIndex(OIndexAbstract.java:940)
at com.orientechnologies.orient.core.index.OIndexAbstract.indexCluster(OIndexAbstract.java:1040)
at com.orientechnologies.orient.core.index.OIndexAbstract.fillIndex(OIndexAbstract.java:539)
at com.orientechnologies.orient.core.index.OIndexAbstract.rebuild(OIndexAbstract.java:500)
at com.orientechnologies.orient.core.index.OIndexAbstract.rebuild(OIndexAbstract.java:403)
at com.orientechnologies.orient.core.index.OIndexAbstractDelegate.rebuild(OIndexAbstractDelegate.java:167)
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLRebuildIndex.execute(OCommandExecutorSQLRebuildIndex.java:91)
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.execute(OCommandExecutorSQLDelegate.java:70)
at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.executeCommand(OAbstractPaginatedStorage.java:3400)
at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.command(OAbstractPaginatedStorage.java:3318)
at com.orientechnologies.orient.core.command.OCommandRequestTextAbstract.execute(OCommandRequestTextAbstract.java:69)
at com.orientechnologies.orient.console.OConsoleDatabaseApp.sqlCommand(OConsoleDatabaseApp.java:3076)
at com.orientechnologies.orient.console.OConsoleDatabaseApp.rebuildIndex(OConsoleDatabaseApp.java:1273)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.orientechnologies.common.console.OConsoleApplication.execute(OConsoleApplication.java:405)
at com.orientechnologies.common.console.OConsoleApplication.executeCommands(OConsoleApplication.java:260)
at com.orientechnologies.common.console.OConsoleApplication.run(OConsoleApplication.java:131)
at com.orientechnologies.orient.console.OConsoleDatabaseApp.main(OConsoleDatabaseApp.java:145)
at org.sonatype.nexus.orient.console.Main.main(Main.java:63)

Error: com.orientechnologies.orient.core.storage.ORecordDuplicatedException: Cannot index record #27:2092: found duplicated key ‘OCompositeKey{keys=[#24:1, null, vao/vao_base, vao_base_chrome]}’ in index ‘component_bucket_group_name_version_idx’ previously assigned to the record #25:2108
DB name=“component” INDEX=component_bucket_group_name_version_idx RID=#25:2108

I am getting duplicate key errors on the indexes.

How can I rebuild the index? How can i remove this duplicate key?

Try dropping the index and then recreating it. Sometimes this works for me.
If the ORecordDuplicatedException is thrown in the creation of the index, so there are vertices that violate the uniqueness.