Error: "An Item with the same key has already been added" randomly appears for random users in Web Access and Console

Version 9

    Verified Product Versions

    Service Desk 7.6Service Desk 7.7.xService Desk 7.8.x


    Service Desk -  7.8.2 and earlier.


    Some users are getting the below error message when trying to log in to Console or move around in Web Access or Console.


    "An Item with the same key has already been added"



    This is happening due to a duplication of a row being created in the Database tps_user_preference table. It happens when using multiple Instances and both Instances create their own row in the table before the product has time to cache and therefore before the product has time to realised that a row has already been created. It's very common to use multiple Instances if you are using load balancing.


    The tps_user_preference table holds information specific to each user for things such as the width of the shortcut bar, which shortcut bar group should be shown or if the history panel is showing.


    All these rows are read when you log in to Service Desk in either Console or Web Access and if a user user has a duplicated row in the tps_user_preference table Service Desk will try to run through both of them, but on the second one, since it's already run through the first one it will error with the above error message.


    This has been logged as problem 6191 and have been fixed in our 7.8.3 release - Release Date: 06.10.2015



    There is a couple of workarounds that you can apply and the choice of workaround should be dependant on how often you experiencing the issue.

    If this is a one off, then you can run the below script which will simply delete the values for the specific user.

    If this happens a lot then there is a trigger attached that you can apply to your database that will make sure any duplications are deleted as they are created.


    Please note that this trigger doesn't need any modification, but the below script will require you to enter the affect users login name.


    delete from tps_user_preference where tps_user_guid = (select tps_guid from tps_user where tps_name = '<<LOGIN>>')