Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Error on specific language

Vote:
 

Hi Everyone!
I'm working with Episerver Commerce 9.11, and for some super odd reason, one of our countries gives this error on all category pages on the UK website. Please see the error below.

Server Error in '/' Application.

An item with the same key has already been added.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: An item with the same key has already been added.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[ArgumentException: An item with the same key has already been added.]
   System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) +60
   System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +452
   Mediachase.MetaDataPlus.Configurator.MetaObjectDB.LoadMetaObjectData(MetaDataContext context, Int32 metaObjectId, MetaClass metaClass, String fallbackLanguage) +2308
   Mediachase.MetaDataPlus.MetaObject.DoLoad(MetaDataContext context, Int32 objectId, MetaClass metaClass) +424
   Mediachase.MetaDataPlus.MetaObject.Load(MetaDataContext context, Int32 objectId, Int32 metaClassId) +40
   Mediachase.Commerce.Catalog.Dto.CatalogNodeRowExtensions.IsPublished(CatalogNodeRow row, MetaDataContext context) +46
   EPiServer.Commerce.Catalog.Provider.Construction.NodeBuilder.ConstructNodes(IEnumerable`1 nodeRows, IDictionary`2 versionForUnpublishedContent, String language) +503
   EPiServer.Commerce.Catalog.Provider.CatalogContentLoader.ConstructContent(IList`1 contentLinks, Func`3 createContentFunc) +748
   EPiServer.Commerce.Catalog.Provider.CatalogContentLoader.LoadSpecificContentInstances(IList`1 contentLinks, String language) +574
   EPiServer.Commerce.Catalog.Provider.CatalogContentProvider.BatchLoad(IList`1 contentLinks, Func`2 dbLoader) +235
   EPiServer.Commerce.Catalog.Provider.CatalogContentProvider.LoadContents(IList`1 contentReferences, ILanguageSelector selector) +625
   EPiServer.Core.ContentProvider.GetScatteredContents(IEnumerable`1 contentLinks, ILanguageSelector selector) +817
   EPiServer.Core.ProviderPipelineImplementation.GetItems(ContentProvider provider, IList`1 contentLinks, LoaderOptions loaderOptions) +320
   EPiServer.Core.DefaultContentLoader.GetChildren(ContentReference contentLink, LoaderOptions loaderOptions, Int32 startIndex, Int32 maxRows) +2160
   EPiServer.Core.DefaultContentLoader.GetChildren(ContentReference contentLink, CultureInfo language) +202
   EPiServer.Commerce.Routing.HierarchicalCatalogPartialRouter.FindNextContentInSegmentPair(CatalogContentBase catalogContent, SegmentPair segmentPair, SegmentContext segmentContext, CultureInfo cultureInfo) +301
   EPiServer.Commerce.Routing.HierarchicalCatalogPartialRouter.GetCatalogContentRecursive(CatalogContentBase catalogContent, SegmentPair segmentPair, SegmentContext segmentContext, CultureInfo cultureInfo) +200
   EPiServer.Commerce.Routing.HierarchicalCatalogPartialRouter.RoutePartial(PageData content, SegmentContext segmentContext) +359
   EPiServer.Web.Routing.Segments.PartialSegment.RouteDataMatch(SegmentContext context) +350
   System.Linq.Enumerable.All(IEnumerable`1 source, Func`2 predicate) +172
   EPiServer.Web.Routing.ContentRoute.RouteSegmentContext(SegmentContext segmentContext) +16
   EPiServer.Web.Routing.ContentRoute.GetRouteData(HttpContextBase httpContext) +477
   System.Web.Routing.RouteCollection.GetRouteData(HttpContextBase httpContext) +1076
   System.Web.Routing.RouteCollection.GetRouteData(HttpContextBase httpContext) +1935
   System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context) +68
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +229
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +931


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1087.0

#175709
Feb 27, 2017 22:40
Vote:
 

It seems to me that you have duplicated rows in CatalogContentProperty in that language. The combination of (ObjectId, ObjectTypeId, LanguageName and MetaFieldId) is supposed to be unique, but that was not constrained in Commerce 9.11. So for some reasons, such as a faulty import, it can end up problematic. Would suggest you to upgrade to at least Commerce 9.14, which fixed that specific issue (bug COM-1459)

#175713
Feb 28, 2017 9:31
Vote:
 

Quan.. You sir, are the man. Thank you so much, this is exactly what the cause of this was. CatalogContentProperty had only 4 duplicate records, but the entire site was like hosed. Good job!

-Paul

#175730
Feb 28, 2017 17:08
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.