If there are duplicate values in the database, you may encounter the following error message in the DNN Logs located in the Portals/_default/Logs folder and the browser console logs by pressing F12.:
An item with the same key has already been added.
This article describes the troubleshooting process and resolution for this issue.
- Access to the DNN database (from site interface or directly via SSMS)
Determine the DNN feature that is failing and check the related tables.
For example: If the issue is related to pages, check the
TabVersionstables in the database. If the issues are related to modules on pages, check the TabModules and TabModuleDetails tables.
Use theIf the issue is occurring while accessing modules on pages, run the following command:
SELECTcommand to find the duplicate entries while filtering with the related feature id.
SELECT * FROM TabModules WHERE TabID = '<page ID>'To find out at any instances of duplicated IDs.
SELECT TabID, COUNT(*) FROM Tabs GROUP BY TabID HAVING COUNT(*) > 1Where <page ID> is the ID of the page where the issue is occurring.
This might simplify the process of identifying the offending record for the end-user.
From the returned results, note down the data discrepancies and duplicates and have a clear understanding of what needs to be fixed to resolve the error.
Create a backup of the database.
Restore the backup in a test environment.
Remove the duplicate data that you have identified while troubleshooting.
Access the DNN logs in the SiteRoot/Portals/_default/Logs folder to see if there are any same key errors from before.
If the test is successful, perform the same steps on the actual database.
- Repeat the steps which initially caused the error that you've performed in the Diagnosis to confirm the issue has been successfully resolved.