Import redirects not working

Hi,

We are getting below error when trying to import url redirects, even though the key doesn’t already exist in the redirects, if we search in BO.

An item with the same key has already been added.

System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.<ToDictionaryAsync>d__903.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.d__903.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Litium.Web.Administration.WebApi.Import.UrlRedirectImportProcessor.<>c__DisplayClass2_0.<<ImportAsync>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Litium.Application.Data.DbContextExtension.<ExecuteInDbContextAsync>d__41.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Litium.Web.Administration.WebApi.Import.UrlRedirectImportProcessor.d__2.MoveNext()

Litium version: 7.7.2

could we do something about this?

Does the key exist in the database? We had a similar case a while back where some keys existed twice in the database. Didn’t report it as a bug as we were not able to reproduce it, but it did throw a similar error to what you are seeing. Solution was simply to remove one of the duplicate values in the database and restart the site.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.