> ## Content Index
> Fetch the complete content index at: https://blog.tsd.digital/llms.txt
> Use this file to discover other available public pages before exploring further.

# Error running Ucommerce scratch indexer Illegal duplicate key definitions
- URL: https://blog.tsd.digital/error-running-ucommerce-scratch-indexer-illegal-duplicate-key-definitions/
- Published: 2019-08-02T13:40:17.000Z
- Updated: 2019-08-02T13:40:17.000Z
- Author: Tim Gaunt
- Tags: SQL Server, Useful Script, Ucommerce, #Import 2025-04-01 05:38

We hit an interesting issue indexing the Ucommerce data the other day which had us going for a while.

It turns out that when upgrading Ucommerce to 7.0.6, some new payment providers were added to \`uCommerce\_Definition\` with duplicate Guids which then caused an issue. We found it by searching the database for the value \`c94644e4-f213-48a6-98eb-741aca16155f\`.

In our instance it was

IdName4Adyen9eWAY19Ideal (Ing Bank)21Schibsted

The fix was to remove this duplicate. If you want to \_just update\_ the data you can run this (assuming the ids are the same!):

```sql
UPDATE uCommerce_Definition 
SET Guid=NEWID() 
WHERE DefinitionId IN (4,9,19,21)
```

It would probably be worth checking your data though as I suspect the Guids will be different so you can find these using this:

```sql
SELECT * 
FROM uCommerce_Definition d 
WHERE EXISTS(
    SELECT * 
    FROM uCommerce_Definition id 
    WHERE id.Guid=d.Guid AND id.DefinitionId<>d.DefinitionId
)
```

The error it threw was when indexing/scratch indexing and it looks like this: the key bit is after the \`/\` i.e. in \`definitions/c94644e4-f213-48a6-98eb-741aca16155f\`, \`c94644e4-f213-48a6-98eb-741aca16155f\` is the Guid you need to look for.

```plain
System.AggregateException: One or more errors occurred. ---> Raven.Abstractions.Exceptions.ConcurrencyException: Illegal duplicate key definitions/c94644e4-f213-48a6-98eb-741aca16155f ---> Microsoft.Isam.Esent.Interop.EsentKeyDuplicateException: Illegal duplicate key
   at Microsoft.Isam.Esent.Interop.Api.JetUpdate(JET_SESID sesid, JET_TABLEID tableid, Byte[] bookmark, Int32 bookmarkSize, Int32& actualBookmarkSize)
   at Microsoft.Isam.Esent.Interop.Update.Save(Byte[] bookmark, Int32 bookmarkSize, Int32& actualBookmarkSize)
   at Raven.Storage.Esent.StorageActions.DocumentStorageActions.InsertDocument(String key, RavenJObject data, RavenJObject metadata, Boolean overwriteExisting)
   --- End of inner exception stack trace ---
   at Raven.Storage.Esent.StorageActions.DocumentStorageActions.InsertDocument(String key, RavenJObject data, RavenJObject metadata, Boolean overwriteExisting)
   at Raven.Database.Actions.DocumentActions.<>c__DisplayClass1c.b__17(IStorageActionsAccessor accessor)
   at Raven.Storage.Esent.TransactionalStorage.ExecuteBatch(Action`1 action, EsentTransactionContext transactionContext)
   at Raven.Storage.Esent.TransactionalStorage.Batch(Action`1 action)
   at Raven.Database.Actions.DocumentActions.BulkInsert(BulkInsertOptions options, IEnumerable`1 docBatches, Guid operationId, CancellationToken token)
   at Raven.Database.Server.Controllers.BulkInsertController.<>c__DisplayClass6.b__3()
```