When creating a new or editing an existing workflow in Microsoft Dynamics 365 you may be presented with the error "An item with the same key has already been added".
Clicking on the Download Log button will display the following information.
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: System.ArgumentException: An item with the same key has already been added.Detail:
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
<ActivityId>afa2227c-21ba-4588-a11f-e8d0dd02a289</ActivityId>
<ErrorCode>-2147220970</ErrorCode>
<ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<Message>System.ArgumentException: An item with the same key has already been added.</Message>
<Timestamp>2017-11-08T20:52:35.6280057Z</Timestamp>
<ExceptionRetriable>false</ExceptionRetriable>
<ExceptionSource i:nil="true" />
<InnerFault i:nil="true" />
<OriginalException i:nil="true" />
<TraceText i:nil="true" />
</OrganizationServiceFault>
If platform tracing has been enabled, you will see the following errors logged within the trace.
MSCRM Error Report:
--------------------------------------------------------------------------------------------------------
Error: An item with the same key has already been added.
Error Message: An item with the same key has already been added.
Source File: Not available
Line Number: Not available
Request URL: http://CrmOrgName.dynamics.com/AppWebServices/Workflow.asmx
Stack Trace Info: [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 Microsoft.Crm.Application.Components.UI.OptionGroup.AddItem(String text, String value, ListDictionary expandos)
at Microsoft.Crm.Application.Controls.CreateStepControl.RenderEntityList(HtmlTextWriter writer, StepControlType stepType, String onChange)
at Microsoft.Crm.Application.Controls.StepBaseControl.RenderEntity(HtmlTextWriter writer, StepControlType stepType, String onChange)
at Microsoft.Crm.Application.Controls.CreateStepControl.Render(HtmlTextWriter writer)
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
at Microsoft.Crm.Application.Controls.CompositeStepBaseControl.RenderChildSteps(HtmlTextWriter writer)
at Microsoft.Crm.Application.Controls.WorkflowStepControl.Render(HtmlTextWriter writer)
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
at Microsoft.Crm.Application.WebServices.WorkflowWebService.RenderWorkflow(WorkflowStep workflowStep, Boolean bSave, String parentStepId, String rendererTypeCode)
at Microsoft.Crm.Application.WebServices.WorkflowWebService.RenderWorkflow(WorkflowStep workflowStep, String parentStepId, String rendererTypeCode)
at Microsoft.Crm.Application.WebServices.WorkflowWebService.AddCreateEntityStep(String parentId, String entityId, String descriptionXml, String parentStepId, String rendererTypeCode)
Additionally, you may also see the following.
*** MSCRM:ASSERTEX *** - ENTITY Singular LOCALIZED NAME NOT FOUND: logical name = 'msdyn_orginsightsuserdashboarddefinition' LANGUAGE ID = 1033