ContentIndexerException: The 'RelatedContent' function could not be evaluated for Content

Vote:
 

Lately, we've been seeing this error showing up quite extensively in our logs. It only seems to happen for Commerce Content.

We are running Episerver CMS 11.20.2, Episerver CMS UI 11.31.0, Episerver Find 13.3.0 and Episerver Commerce 12.7.2:

2021-01-22 00:52:51,211 [178] ERROR EPiServer.Find.Cms.ContentEventIndexer: An exception occurred while indexing (IContent). The 'RelatedContent' function could not be evaluated for Content: 95161__CatalogContent. An item with the same key has already been added..
EPiServer.Find.Cms.ContentIndexerException: The 'RelatedContent' function could not be evaluated for Content: 95161__CatalogContent. 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.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at EPiServer.DataAbstraction.ReferenceInformation.CreateReferenceInformation(DataTable data, ILanguageBranchRepository languageBranchRepository, IPermanentLinkMapper permanentLinkMapper)
   at EPiServer.Core.Internal.DefaultContentProvider.GetReferencesToContentItems(IEnumerable`1 contentLinks)
   at EPiServer.Core.Internal.DefaultContentRepository.<>c__DisplayClass45_0.<GetReferencesToContent>b__0(ContentProvider p)
   at EPiServer.Core.ContentProviderMap.Iterate(Action`1 contentProviderHandler)
   at EPiServer.Core.Internal.DefaultContentRepository.GetReferencesToContent(ContentReference contentLink, IEnumerable`1 descendents, Boolean includeDescendants)
   at EPiServer.DataFactory.GetReferencesToContent(ContentReference contentLink, Boolean includeDecendents)
   at EPiServer.Find.Cms.Module.IndexingModule.<RegisterRelatedContentForContentAreaContent>b__34_0(IContent x)
   at EPiServer.Find.Cms.Conventions.RelatedContentConvention.RelatedContent(IContent content)
   at EPiServer.Find.Cms.ContentIndexer.RelatedContent(IContent content)
   --- End of inner exception stack trace ---
   at EPiServer.Find.Cms.ContentIndexer.RelatedContent(IContent content)
   at EPiServer.Find.Cms.ContentIndexer.RelatedContentTree(IContent content, IEnumerable`1 traversedContent)
   at EPiServer.Find.Cms.ContentIndexer.Index(IEnumerable`1 contents, IndexOptions options)
   at EPiServer.Find.Cms.ContentEventIndexer.Index(IEnumerable`1 contentLinks)
   at EPiServer.Find.Cms.ContentEventIndexer.Sync(IEnumerable`1 contentToIndex, HashSet`1 contentToIndexSet, Func`1 index)
   at EPiServer.Find.Cms.ContentEventIndexer.IndexPageQueue(IEnumerable`1 contentToIndex)
   at EPiServer.Find.Cms.ContentEventIndexer.IndexPageQueue()
EPiServer.Find.Cms.ContentIndexerException: The 'RelatedContent' function could not be evaluated for Content: 95161__CatalogContent. 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.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at EPiServer.DataAbstraction.ReferenceInformation.CreateReferenceInformation(DataTable data, ILanguageBranchRepository languageBranchRepository, IPermanentLinkMapper permanentLinkMapper)
   at EPiServer.Core.Internal.DefaultContentProvider.GetReferencesToContentItems(IEnumerable`1 contentLinks)
   at EPiServer.Core.Internal.DefaultContentRepository.<>c__DisplayClass45_0.<GetReferencesToContent>b__0(ContentProvider p)
   at EPiServer.Core.ContentProviderMap.Iterate(Action`1 contentProviderHandler)
   at EPiServer.Core.Internal.DefaultContentRepository.GetReferencesToContent(ContentReference contentLink, IEnumerable`1 descendents, Boolean includeDescendants)
   at EPiServer.DataFactory.GetReferencesToContent(ContentReference contentLink, Boolean includeDecendents)
   at EPiServer.Find.Cms.Module.IndexingModule.<RegisterRelatedContentForContentAreaContent>b__34_0(IContent x)
   at EPiServer.Find.Cms.Conventions.RelatedContentConvention.RelatedContent(IContent content)
   at EPiServer.Find.Cms.ContentIndexer.RelatedContent(IContent content)
   --- End of inner exception stack trace ---
   at EPiServer.Find.Cms.ContentIndexer.RelatedContent(IContent content)
   at EPiServer.Find.Cms.ContentIndexer.RelatedContentTree(IContent content, IEnumerable`1 traversedContent)
   at EPiServer.Find.Cms.ContentIndexer.Index(IEnumerable`1 contents, IndexOptions options)
   at EPiServer.Find.Cms.ContentEventIndexer.Index(IEnumerable`1 contentLinks)
   at EPiServer.Find.Cms.ContentEventIndexer.Sync(IEnumerable`1 contentToIndex, HashSet`1 contentToIndexSet, Func`1 index)
   at EPiServer.Find.Cms.ContentEventIndexer.IndexPageQueue(IEnumerable`1 contentToIndex)
   at EPiServer.Find.Cms.ContentEventIndexer.IndexPageQueue()

Any ideas on why this is happening?

#247460
Edited, Jan 22, 2021 11:11
Vote:
 

I believe this is caused by bug CMS-17307, which is resolved in (drum on) 11.20.3. So upgrade and it should be fine (I guess :) ) 

#247473
Jan 22, 2021 12:07
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.