Why is Epicor Throwing this Error - Please help

Application Error

Exception caught in: Epicor.ServiceModel

Error Detail

Message: An EdmType cannot be mapped to CLR classes multiple times. The EdmType ‘EpicorDB.ABCCode’ is mapped more than once.
Inner Exception Message: An item with the same key has already been added.
Program: Epicor.ServiceModel.dll
Method: ShouldRethrowNonRetryableException

Client Stack Trace

at System.Data.Metadata.Edm.ObjectItemCollection.LoadAssemblyFromCache(ObjectItemCollection objectItemCollection, Assembly assembly, Boolean loadReferencedAssemblies, EdmItemCollection edmItemCollection, Action1 logLoadMessage) at System.Data.Metadata.Edm.ObjectItemCollection.ImplicitLoadAssemblyForType(Type type, EdmItemCollection edmItemCollection) at System.Data.Metadata.Edm.MetadataWorkspace.ImplicitLoadAssemblyForType(Type type, Assembly callingAssembly) at System.Data.Objects.ObjectContext.GetTypeUsage(Type entityCLRType) at System.Data.Objects.ObjectContext.GetEntitySetForNameAndType(String entitySetName, Type entityCLRType, String exceptionParameterName) at System.Data.Objects.ObjectContext.CreateObjectSet[TEntity](String entitySetName) at Erp.ErpContext.get_UserFile() in c:\_Releases\ERP\RL10.1.500\Source\Server\Db\Erp.Data.910100\ErpContext.Model.cs:line 199569 at lambda_method(Closure ) at System.Data.Objects.ELinq.Funcletizer.FuncletizingVisitor.InlineValue(Expression expression, Boolean recompileOnChange) at System.Data.Objects.ELinq.Funcletizer.FuncletizingVisitor.Visit(Expression exp) at System.Linq.Expressions.EntityExpressionVisitor.VisitExpressionList(ReadOnlyCollection1 original)
at System.Linq.Expressions.EntityExpressionVisitor.VisitMethodCall(MethodCallExpression m)
at System.Data.Objects.ELinq.Funcletizer.FuncletizingVisitor.Visit(Expression exp)
at System.Linq.Expressions.EntityExpressionVisitor.VisitExpressionList(ReadOnlyCollection1 original) at System.Linq.Expressions.EntityExpressionVisitor.VisitMethodCall(MethodCallExpression m) at System.Data.Objects.ELinq.Funcletizer.FuncletizingVisitor.Visit(Expression exp) at System.Linq.Expressions.EntityExpressionVisitor.VisitExpressionList(ReadOnlyCollection1 original)
at System.Linq.Expressions.EntityExpressionVisitor.VisitMethodCall(MethodCallExpression m)
at System.Data.Objects.ELinq.Funcletizer.FuncletizingVisitor.Visit(Expression exp)
at System.Data.Objects.ELinq.Funcletizer.Funcletize(Expression expression, Func1& recompileRequired) at System.Data.Objects.ELinq.ExpressionConverter..ctor(Funcletizer funcletizer, Expression expression) at System.Data.Objects.ELinq.CompiledELinqQueryState.CreateExpressionConverter() at System.Data.Objects.ELinq.CompiledELinqQueryState.GetExecutionPlan(Nullable1 forMergeOption)
at System.Data.Objects.ObjectQuery1.GetResults(Nullable1 forMergeOption)
at System.Data.Objects.ObjectQuery1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source)
at System.Data.Objects.CompiledQuery.ExecuteQuery[TResult](ObjectContext context, Object[] parameterValues)
at Epicor.Data.DBExpressionCompiler.GetResult[TContext,TQuery,TResult](Func3 executeQuery, Cache cacheSetting, TContext dataContext, TQuery query) in C:\_Releases\ICE\3.1.500.13\Source\Framework\Epicor.System\Data\DBExpressionCompiler.cs:line 439 at Epicor.Data.DBExpressionCompiler.InvokeSingle[TContext,TQuery,TResult](Expression expression, Cache currentCacheSetting, Boolean cacheQuery, TContext dataContext, Func2 getDataCacheKey, Func2 compileQuery, Func3 executeQuery) in C:_Releases\ICE\3.1.500.13\Source\Framework\Epicor.System\Data\DBExpressionCompiler.cs:line 300
at Epicor.Data.DBExpressionCompiler.<>c__DisplayClass33_03.<Compile>b__0(TContext context, TArg1 arg1) in C:\_Releases\ICE\3.1.500.13\Source\Framework\Epicor.System\Data\DBExpressionCompiler.Generated.cs:line 1082 at Erp.Extensibility.UserFileExtender.AfterGetRows(UserFileTableset mainTableSet) in c:\_Releases\ERP\RL10.1.500\Source\Server\Internal\Extensibility\UserFileExtender\UserFileExtender.cs:line 46 at Ice.Services.BO.UserFileSvc.DoWithUserFileExtension(Action1 action) in C:_Releases\ICE\3.1.500.13\Source\Server\Services\BO\UserFile\UserFile.cs:line 1024
at Ice.Services.BO.UserFileSvc.AfterGetRows() in C:_Releases\ICE\3.1.500.13\Source\Server\Services\BO\UserFile\UserFile.cs:line 505
at Ice.Services.Trace.TablesetProfilingCollector.DoTablesetEventTrace(String tablesetName, String methodName, Action action) in C:_Releases\ICE\3.1.500.13\Source\Framework\Epicor.Ice\Services\TablesetProfilingCollector.cs:line 200
at Ice.TablesetBound3.InnerGetByID(IceDataContext dataContext, Int32 pageSize, Int32 absolutePage, Boolean& morePages, TFullTableset tableset, IEnumerable1 queryParameters) in C:_Releases\ICE\3.1.500.13\Source\Framework\Epicor.Ice\Services\TablesetBound.cs:line 693
at Ice.Services.BO.UserFileSvc.GetByID(String userID) in C:_Releases\ICE\3.1.500.13\Source\Server\Services\BO\UserFile\UserFile.Designer.cs:line 851
at Ice.Services.BO.UserFileSvcFacade.GetByID(String userID) in C:_Releases\ICE\3.1.500.13\Source\Server\Services\BO\UserFile\UserFileSvcFacade.cs:line 348
at SyncInvokeGetByID(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at Epicor.Hosting.OperationBoundInvoker.InnerInvoke(Object instance, Func2 func) in C:\_Releases\ICE\3.1.500.13\Source\Framework\Epicor.System\Hosting\OperationBoundInvoker.cs:line 59 at Epicor.Hosting.OperationBoundInvoker.Invoke(Object instance, Func2 func) in C:_Releases\ICE\3.1.500.13\Source\Framework\Epicor.System\Hosting\OperationBoundInvoker.cs:line 47
at Epicor.Hosting.Wcf.EpiOperationInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) in C:_Releases\ICE\3.1.500.13\Source\Framework\Epicor.System\Hosting\Wcf\EpiOperationInvoker.cs:line 23
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
Inner Trace:
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.Data.Metadata.Edm.ObjectItemCollection.LoadAssemblyFromCache(ObjectItemCollection objectItemCollection, Assembly assembly, Boolean loadReferencedAssemblies, EdmItemCollection edmItemCollection, Action1 logLoadMessage)

at Epicor.ServiceModel.Channels.ImplBase`1.ShouldRethrowNonRetryableException(Exception ex, DataSet[] dataSets)
at Ice.Proxy.BO.UserFileImpl.GetByID(String userID)
at Ice.Core.Session.setUserDefaults(String userID)
at Ice.Core.Session…ctor(String userID, String password, String asUrl, LicenseType licenseType, String pathToConfigurationFile, Boolean fwVerCheck, String companyID, String plantID)
at Ice.Core.Session…ctor(String userID, String password, LicenseType licenseType)
at IceShell.Apps.LogonDialog.logOn(String userID, String password, Boolean promptUpdatePassword)
at IceShell.Apps.LogonDialog.DoWorkLogon()

Inner Exception

An item with the same key has already been added.

When are you getting this error?

Lots of answers around the forum on this see if any of it helps.

Base Version 10.1.500.0
I have seen several posts, but can’t seem to locate a solution. Every time someone tries to login to Epicor it gives that error and boots them off. We can access Pilot fine, just not Prod. I tried to find the location of the EpicorData and PE, but no luck.

Yeah that’s the version where I had a similar issue. Try this

Regenerate the Database Model-> When done, completely stop the application pool for production (and System Agent Service)
(you can also try IISRESET but that kills the other environments too)
Once the app server is fully stopped (if you didn’t use IISRESET) look in Task Manager and make sure the w3wp process that belongs to the production app server stops and disappears.

Then start it back up

1 Like

How does one “Regenerate the Database Model” and is that process just telling Epicor to kind of restart itself? Would that option be in the client folder? Is it one of the execution (exe) files like maybe DataModelGenerator.exe? So technically all I have to do is run the exe file and Epicor should sort itself out? lol :slight_smile: Also, does this proposed solution require Admin rights?

Are you not the Epicor Administrator for your company? Are you the only user having this issue? It was my understanding that everyone was on the same boat?

You regenerate the data model in the Adminn Console and yes you need admin right.

Unfortunately, I am not ‘technically’ the Epicor Administrator by title, but I am the one who knows the application the best in my company. All our onsite IT retired with no one to take their place and our remote IT has no idea what Epicor is or how it functions being they run a different ERP at all our other locations.:slightly_frowning_face: (I learned a lot from our previous IT, as well as from this forum. However, there are things still to learn.)
I typically have to either tell our IT department what the problem is and how to fix it or physically write them step by step work instructions for the changes/updates/fixes I want them to make. All of that just to get the rights temporarily assigned to me so I may make the changes myself. Its a process. lol

Yeah you will need admin right sin that case. Login to the Epicor Application Server Regenerate the Data Model in Admin Console then IISRESET command (Command Line Admin Rights)

BUT I really don’t recommend you do this if you don’t know what you are doing, this may be a good time to call Epicor Support.