DotNetNuke: An entry with the same key already exists – Error
If you receive the following error:
Message:
DotNetNuke.Services.Exceptions.ModuleLoadException: An entry with the same key already
exists. —> System.ArgumentException: An entry with the same key already exists.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.SortedList`2.Add(TKey
key, TValue value) at DotNetNuke.Entities.Modules.DesktopModuleController.GetPortalDesktopModules(Int32
portalID) at DotNetNuke.UI.ControlPanels.IconBar.BindData() at DotNetNuke.UI.ControlPanels.IconBar.Page_Load(Object
sender, EventArgs e) — End of inner exception stack trace —
Cause:
This is likely due to duplicate Keys in the DeskTopModules table.
In our case we had a third party Google Analytics Module installed and the newer
versions of DNN 5.x include Google Analytics as part of the core. Apparently
during the upgrade process DNN inserts a new record in the DeskTopModules table
that uses the same FriendlyName as the existing 3rd party Google Analytics Module
already in use therefore creating a conflict.
Resolution:
Open the DesktopModules table and sort by FriendlyName Ascending
locate the duplicate key and give one of the duplicates key a unique name.
Restart your website – found under hosting settings – and the problem should disappear.