Costing Workbench error: Violation of PRIMARY KEY constraint 'PK_CostPart'. Cannot insert duplicate key in object 'Erp.CostPart'

Anyone ever see anything along these lines? I have looked at our part in the violation statement “DEC-510” nothing seems strange about it.

I have a ticket into Epicare as well. just thought I would put it out here. We are trying to do a cost roll and the Load Costing Workbench Details process errors out with error message below.

Program Ice.Services.Lib.RunTask raised an unexpected exception with the following message: RunTask: An error occurred while updating the entries. See the inner exception for details.
Stack Trace:
at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(SaveOptions options, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction)
at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesInternal(SaveOptions options, Boolean executeInExistingTransaction)
at Ice.IceDataContext.SaveChanges(SaveOptions options) in C:\_Releases\ICE\ICE3.2.300.13\Source\Framework\Epicor.System\Data\IceDataContext.cs:line 356
at Ice.IceDataContext.Validate[TLinqRow](TLinqRow row) in C:\_Releases\ICE\ICE3.2.300.13\Source\Framework\Epicor.System\Data\IceDataContext.cs:line 317
at Erp.Internal.BM.BMM20.createCostPart(String cGroupID) in C:\_Releases\ERP\UD10.2.300.13\Source\Server\Internal\BM\BMM20\BMM20.cs:line 775
at Erp.Internal.BM.BMM20.RunProcess(Int64 instanceTaskNum, String outputFileName) in C:\_Releases\ERP\UD10.2.300.13\Source\Server\Internal\BM\BMM20\BMM20.cs:line 369
at Ice.Core.TaskBase`1.StartProcess(Int64 instanceTaskNum, String outputFileName) in C:\_Releases\ICE\ICE3.2.300.13\Source\Server\Internal\Lib\TaskLib\TaskBase\TaskBase.cs:line 47
at Ice.Hosting.TaskCaller.InnerExecuteTask(IceDataContext newContext) in C:\_Releases\ICE\ICE3.2.300.13\Source\Framework\Epicor.Ice\Hosting\TaskCaller\TaskCaller.cs:line 98
at Ice.Hosting.TaskCaller.ExecuteTask() in C:\_Releases\ICE\ICE3.2.300.13\Source\Framework\Epicor.Ice\Hosting\TaskCaller\TaskCaller.cs:line 57
at Ice.Lib.RunTask.BpmFriendlyTaskLauncher.Run(String sessionIdPrefix, IceContext db, Action taskRunner) in c:\_Releases\ICE\RL3.2.300.0\Source\Server\Services\Lib\RunTask\BpmFriendlyTaskLauncher.cs:line 63
at Ice.Services.Lib.RunTaskSvc.InnerRunTask(Int64 ipTaskNum, Boolean suppressTransaction) in c:\_Releases\ICE\RL3.2.300.0\Source\Server\Services\Lib\RunTask\RunTask.cs:line 577
Inner Exception:
Violation of PRIMARY KEY constraint 'PK_CostPart'. Cannot insert duplicate key in object 'Erp.CostPart'. The duplicate key value is (MHS, test, P, DEC-510).
The statement has been terminated.
Stack Trace:
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
at System.Data.Entity.Core.Mapping.Update.Internal.DynamicUpdateCommand.Execute(Dictionary`2 identifierValues, List`1 generatedValues)
at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()

So Epicor had be run a db conversion to remove trailing spaces. This solved the error. I don’t have a way of knowing what records had issues or what induced the spaces. But it is fixed now. YAY!

BTW I ran it to correct the same issue. There were NO records in my cost part table and yet I still was getting the error. We saw this conversion program reference with some others. I Just wanted to note that the conversion program is 1420.