User profile service error: An item with the same key has already been added RRS feed

  • Question

  • I am getting the following error for a couple site collections spread across a couple web apps:

    Failure trying to synch web application 030f4a93-4989-4129-8d45-0c73f803a312, ContentDB 4ed404e9-d006-4cd0-9b74-43aa06599a87  Exception message was System.ArgumentException: An item with the same key has already been added.
       at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
       at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
       at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector)
       at Microsoft.Office.Server.UserProfiles.ContentDBSynchronizer.SychronizeModifiedProfiles(Guid partitionID, DateTime lastRunTime, DateTime& sqlTime)
       at Microsoft.Office.Server.UserProfiles.ContentDBSynchronizer.SynchContentDB()
       at Microsoft.Office.Server.Diagnostics.FirstChanceHandler.ExceptionFilter(Boolean fRethrowException, TryBlock tryBlock, FilterBlock filter, CatchBlock catchBlock, FinallyBlock finallyBlock)
       at Microsoft.Office.Server.UserProfiles.WSSProfileSyncJob.Execute()

    I am not sure what the bold text "An item with the same key has already been added" means. I couldn't find anything on the internet specific to SharePoint. I tried to use deleteolddatabases and when I do, the synchronized date for everything after deleting, syncing, and listing is always 1/1/0001. Is this correct? Also, I am only getting the event viewer error on a handful of content database though, and they repeat every time the User Profile to SharePoint Full Synchronization runs (every hour). Any help is appreciated.

    Friday, July 17, 2015 1:09 PM

All replies

  • Hi,

    Try to Clear the SharePoint Config cache on all WFE servers and then run the full sync.
    Run old fashioned stsadm -o sync command to delete the old sync info and re sync them.

    stsadm -o sync listolddatabases 0
    stsadm -o sync deleteolddatabases 1

    Also re-start the service and check the issue.

    Hope this helps:)

    Thursday, October 1, 2015 8:38 AM
  • Hi Steve and Everyone,

    How did it turn out? Has there ever been a solution to the problem? Thanks.

    What suggested by Reema Bhingarde did not work, unfortunately

    • Edited by Wandersick Wednesday, March 29, 2017 2:00 AM
    Saturday, March 25, 2017 11:22 AM
  • Further troubleshooting revealed the issue is related to the full sync job from User Profiles database to User Information List (the default hourly job below) that is causing the 5555 critical events. 

    Would anyone please shed some light on the problem? Thanks!

    • Edited by Wandersick Wednesday, March 29, 2017 2:13 AM
    Wednesday, March 29, 2017 2:11 AM
  • having the same issue right now, what did you do to resolve?

    Monday, September 2, 2019 11:12 PM
  • Hi Marc,

    Thanks to Microsoft support. In our case, there were duplicated values in the NTName column in the UserProfile_Full table in the User Profile database.

    CONTOSO\ChrisLee.win7 0x0123000000000005150000007123123D1ADE2C7A75B9755412340000

    CONTOSODOM\ChrisLee.win7 0x0123000000000005150000007123123D1ADE2C7A75B9755412340000

    The above row data is for the same user, one is the user's domain name DNS, and the other is the user's domain NetBIOS name.

    SharePoint uses NTName colume (AccountName) as the key for the Dictionary variable. When SharePoint tries to convert the user profile list to a dictionary with NTName as the key, the error "An item with the same key has already been added." as these two lines have the same NTName "ChrisLee.win7".

    As the name of the domain DNS name is not available in AD, removing this value from the user profile table resolves this issue.

    Therefore, if this sounds like your scenario, you may research how to remove the value from user profile table.

    Hope it helps.

    Tuesday, September 3, 2019 7:01 AM
  • Thanks so much for getting back to me. I have been troubleshooting this issue for the last two days straight. In my production and development farm all my web apps are out of sync and show 1/1/0001 as the date. I’m not familiar with just removing these entries. Do you know how? See my thread https://social.technet.microsoft.com/Forums/en-US/60e87383-b455-419a-8176-7b3649e51840/sharepoint-2013-event-id-5555-an-item-with-the-same-key-has-already-been-added?forum=sharepointgeneral
    Tuesday, September 3, 2019 7:12 AM
  • Hi Marc,

    I am sorry to see you in desparate need of help but "web apps being out of sync on production and devlopment farms" does not sound like my case, unfortunately. Also, I don't remember having an invalid date as 1/1/0001.

    Due to the seriousness of the case, it is recommended you contact Microsoft support, via your local Microsoft partners or other means. They have helped me solve the problem, but only after a long period of troubleshooting, communication and coordination among all parties involved.
    Tuesday, September 3, 2019 8:31 AM
  • I'm not sure I understand.

    Did you not have the same issue (same key has been added event id 5555)?

    I was under the impression you did, because im having the exact issues as the original poster.

    Once i ran deleteolddatabases 

    the dates on the databases never changed from 1/1/0001.

    Anytime i ran user profile to sharepoint full synch, i would get the error stating the same key has been added in event 5555.

    But youre saying you didnt have that. what issues were you experiencing then?

    Tuesday, September 3, 2019 2:37 PM