Few days ago we updated EPiServer together with EPiServer Commerce. We also have EPiServer Commerce Manager nuget installed in EPiServer CMS.
From time to time when cms application starts the exeption is thrown. When I refresh the page everything is working - so it's looks like an initialization exception.
We are using CMS and Commerce since EPiServer 6R2, so it could be some obsolete web.config setting that should be changed or removed. Do you have any idea what could it be?
Meta field already exists.
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: Mediachase.BusinessFoundation.Data.Meta.Management.MetaFieldAlreadyExistsException: Meta field already exists.
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.
Below is exception and stack trace:
[MetaFieldAlreadyExistsException: Meta field already exists.] Mediachase.BusinessFoundation.Data.Meta.Management.MetaClass.CreateMetaField(String Name, String FriendlyName, String TypeName, Boolean IsNullable, String DefaultValue, AttributeCollection Attributes) +1077 Mediachase.BusinessFoundation.Data.Meta.Management.MetaFieldBuilder.CreateText(String name, String friendlyName, Boolean isNullable, Int32 maxLength, Boolean isUnique) +352 Mediachase.Commerce.Customers.Plugins.AutoInstallMetaDataModule.InstallUserId(String connectionString) +227 Mediachase.Commerce.Customers.Plugins.AutoInstallMetaDataModule.Execute(BusinessContext context) +261 Mediachase.BusinessFoundation.Data.Business.BusinessManager.ExecutePlugins(EventPipeLineStage eventPipeLineStage) +113 Mediachase.BusinessFoundation.Data.Business.BusinessManager.Execute(Request request) +271 Mediachase.Commerce.Customers.CustomerContext.InnerGetContactByUserId(String userId) +317 EPiServer.Framework.Cache.HttpRuntimeCache.ReadThrough(String key, Func`1 readValue, Func`1 evictionPolicy) +83 Mediachase.Commerce.Extensions.ObjectInstanceCacheExtensions.ReadThrough(IObjectInstanceCache cache, Boolean useCache, String cacheKey, IEnumerable`1 masterKeys, TimeSpan duration, Func`1 load) +229 Mediachase.Commerce.Extensions.ObjectInstanceCacheExtensions.ReadThrough(IObjectInstanceCache cache, String cacheKey, IEnumerable`1 masterKeys, TimeSpan duration, Func`1 load) +109 Mediachase.Commerce.Customers.CustomersCache.ReadThrough(String key, IEnumerable`1 masterKeys, TimeSpan timeout, Func`1 load) +336 Mediachase.Commerce.Customers.CustomerContext.ExecuteThroughCache(String key, TimeSpan timeout, Func`1 load) +78 Mediachase.Commerce.Security.PrincipalExtensions.GetCustomerContact(IPrincipal principal) +247 Mediachase.Commerce.Security.PrincipalExtensions.GetContactId(IPrincipal principal) +197 Mediachase.Commerce.Core.Modules.BusinessFoundationInitializeModule.context_AuthorizeRequest(Object sender, EventArgs e) +31 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165
I can confirm this happens sometimes. We're still tracking it, but my impression is it's annoying but harmless. It might be the order of initializations messes up, but after you refresh it it run well and no visible effect is shown.
Thanks for your answer.
And do you know if someone already reported this as a bug? Then I could check the status in change log.
I'm having this problem too. Has anyone been able to find the cause?
We're working on this bug and it seems to be caused by a race condition. Fortunately It only happens during site initialization and will disappear after refreshing the site.
A fix might be available in upcoming releases of Commerce9.
The bug is now fixed and will be released in next release of Commerce (Possibly 9.2)
And now it's released: