An item with the same key has already been added. Umbraco.Web.Editors.EntityController
Hi all
I'm getting a really strange error when trying to use the search in the umbraco backoffice in one of our builds (happening on the dev and uat build). It's on 7.12.2. I've tried fixing it with the following...
republish entire site.
emptying recycle bins
re-indexing examine
Umbraco.Web.Editors.EntityController
Unhandled controller exception occurred
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 System.Collections.ObjectModel.KeyedCollection2.AddKey(TKey key, TItem item)
at System.Collections.ObjectModel.KeyedCollection2.InsertItem(Int32 index, TItem item)
at Umbraco.Web.Search.SearchableTreeResolver.GetSearchableTrees()
at Umbraco.Web.Editors.EntityController.SearchAll(String query)
at lambda_method(Closure , Object , Object[] )
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_1.<GetExecutor>b__3(Object instance, Object[] methodParameters)
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary2 arguments, CancellationToken cancellationToken)
--- 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 System.Web.Http.Controllers.ApiControllerActionInvoker.
Are there perhaps any duplicate properties in any of your doctypes (with maybe different casing)? I've seen similar errors with that being the problem.
Yes I'm suspecting its something along those lines. I have been using uSync successfully for some time on builds, but I think something has gone wrong in the export/import process that has caused a duplicate somewhere.
You could try below SQL-query on your database. It creates a list of all properties on each document type. You can go trough this list to maybe find any duplicates.
I couldn't test if the query works, as I am not experiencing any problems.
select distinct
pd.contentNodeId,
pt.Alias COLLATE sql_latin1_general_cp1_cs_as as PropertyTypeAlias from cmsPropertyData as pd
inner join cmsPropertyType as pt on pd.propertytypeid = pt.id
order by pd.contentNodeId
If you run the query once with and once without the "COLLATE"-part, you can see if the rows returned by the query are the same for both. if that's the case, you know it's something with duplicate aliases
Thanks for the query, but to keep things simple I re-imported all of the types into an empty (new) database with uSync to see if I could locate the issue more easily without having to be concerned with content.
Still have the problem, but so far cannot locate any offending property types
An item with the same key has already been added. Umbraco.Web.Editors.EntityController
Hi all
I'm getting a really strange error when trying to use the search in the umbraco backoffice in one of our builds (happening on the dev and uat build). It's on 7.12.2. I've tried fixing it with the following...
Umbraco.Web.Editors.EntityController
Unhandled controller exception occurred
System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary
2.Insert(TKey key, TValue value, Boolean add) at System.Collections.ObjectModel.KeyedCollection
2.AddKey(TKey key, TItem item) at System.Collections.ObjectModel.KeyedCollection2.InsertItem(Int32 index, TItem item) at Umbraco.Web.Search.SearchableTreeResolver.GetSearchableTrees() at Umbraco.Web.Editors.EntityController.SearchAll(String query) at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_1.<GetExecutor>b__3(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary
2 arguments, CancellationToken cancellationToken) --- 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 System.Web.Http.Controllers.ApiControllerActionInvoker.Are there perhaps any duplicate properties in any of your doctypes (with maybe different casing)? I've seen similar errors with that being the problem.
Hi Lars
Yes I'm suspecting its something along those lines. I have been using uSync successfully for some time on builds, but I think something has gone wrong in the export/import process that has caused a duplicate somewhere.
Kind regards Martin
You could try below SQL-query on your database. It creates a list of all properties on each document type. You can go trough this list to maybe find any duplicates. I couldn't test if the query works, as I am not experiencing any problems.
If you run the query once with and once without the "COLLATE"-part, you can see if the rows returned by the query are the same for both. if that's the case, you know it's something with duplicate aliases
Hi Lars
Thanks for the query, but to keep things simple I re-imported all of the types into an empty (new) database with uSync to see if I could locate the issue more easily without having to be concerned with content.
Still have the problem, but so far cannot locate any offending property types
is working on a reply...