SharePoint App Deployment Error

shashank 136 Reputation points
2021-12-18T13:45:09.693+00:00

When I go to SharePoint 2019 Site Contents-> K2 Five For SharePoint -> Manage App Deployments. It then throws a correlation id error. Checking the logs I get "An entry with the same key already exists". Please advice

Application error when access /_layouts/15/DeployTSApp.aspx, Error=An entry with the same key already exists. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.TreeSet1.AddIfNotPresent(T item) at System.Collections.Generic.SortedDictionary2.Add(TKey key, TValue value) at Microsoft.SharePoint.ApplicationPages.DeployTSAppPage.AddItemToPicker(List1 selectedItems, SortedDictionary2 selectedItemsToAddToPicker, GroupedItemPicker picker, String id, String name, String description, String group) at Microsoft.SharePoint.ApplicationPages.DeployTSAppPage.AddItemsForLanguage(UInt32 lcid, SortedDictionary2 selectedItemsToAddToPicker, Dictionary2 alreadyAddedTemplates) at Microsoft.SharePoint.ApplicationPages.DeployTSAppPage.LoadSiteTemplatesPicker() at Microsoft.SharePoint.ApplicationPages.DeployTSAppPage.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Unexpected System.ArgumentException: An entry with the same key already exists. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.TreeSet1.AddIfNotPresent(T item) at System.Collections.Generic.SortedDictionary2.Add(TKey key, TValue value) at Microsoft.SharePoint.ApplicationPages.DeployTSAppPage.AddItemToPicker(List1 selectedItems, SortedDictionary2 selectedItemsToAddToPicker, GroupedItemPicker picker, String id, String name, String description, String group) at Microsoft.SharePoint.ApplicationPages.DeployTSAppPage.AddItemsForLanguage(UInt32 lcid, SortedDictionary2 selectedItemsToAddToPicker, Dictionary2 alreadyAddedTemplates) at Microsoft.SharePoint.ApplicationPages.DeployTSAppPage.LoadSiteTemplatesPicker() at Microsoft.SharePoint.ApplicationPages.DeployTSAppPage.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 61c90da0-f750-30ba-205f-65faaae43ba7
12/18/2021 01:00:34.61 w3wp.exe (:0x1A14) 0x3054 SharePoint Foundation General ajlz0 High Getting Error Message for Exception System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.ArgumentException: An entry with the same key already exists. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.TreeSet1.AddIfNotPresent(T item) at System.Collections.Generic.SortedDictionary2.Add(TKey key, TValue value) at Microsoft.SharePoint.ApplicationPages.DeployTSAppPage.AddItemToPicker(List1 selectedItems, SortedDictionary2 selectedItemsToAddToPicker, GroupedItemPicker picker, String id, String name, String description, String group) at Microsoft.SharePoint.ApplicationPages.DeployTSAppPage.AddItemsForLanguage(UInt32 lcid, SortedDictionary2 selectedItemsToAddToPicker, Dictionary2 alreadyAddedTemplates) at Microsoft.SharePoint.ApplicationPages.DeployTSAppPage.LoadSiteTemplatesPicker() at Microsoft.SharePoint.ApplicationPages.DeployTSAppPage.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)

Microsoft 365 and Office SharePoint Server For business
Microsoft 365 and Office SharePoint Development
Microsoft 365 and Office SharePoint For business Windows
Microsoft 365 and Office SharePoint Server Development
{count} votes

2 answers

Sort by: Most helpful
  1. Echo Du_MSFT 17,316 Reputation points
    2021-12-20T07:49:06.293+00:00

    Hi @shashank ,

    This error is due to orphan PWA instances.

    The solution is to check orphan entries in the service application and remove them by PowerShell.

    $PWA = Get-SPServiceApplication | ?{$_.DisplayName -like "Project Server Service Application"}  
    $PWA.SiteCollection | Select Name, ID, @{N='DatabaseName';E={$_.ProjectServiceDatabase.Name}}  
    $RemoveEntry = $PWA.SiteCollection | ?{$_.Id -eq ""}  
    $RemoveEntry.Delete()  
    

    Here are a few similar cases for your reference:

    Thanks,
    Echo Du

    ====================================

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. GAN YU SHEN 1 Reputation point
    2022-08-26T08:03:52.423+00:00

    Hi ! To Whom It May Concern

    I would like to seek your advise on how to resolve this error message which I had never encounter before.

    Please kindly refer to my screenshot image which is for your own reference.

    I am looking forward to hearing from you as soon as possible.

    Your help is much appreciated

    Warmest Regards ,
    Gan Yu Shen THOLMAS

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.