by

PWA error: An entry with the same key already exists

Full story started with a different issue see below.

We had an issue regarding “Create Project Web App Instance” where the first given administrator account display name showed as <i:0#.w|firstname%2c lastname>.

Root cause analysis showed “Failure trying to Sync Web Application – events ID: 5555” in the application log.

Project farm contains only a proxy “User Profile Service Application” which is connect to a different SharePoint farm. I realized from the ULS log there is a simple access denied issue where the SharePoint Project Farm account missed “Full Control” permission on the “User Profile Service Application” on the secondary SharePoint farm.

ULS log entry: Category: User Profiles, Message: Exception occured while connecting to WCF endpoint: System.ServiceModel.Security.SecurityAccessDeniedException: Access is denied.

Issue with the “PWA error” in the title started during my investigation previous problem, when I tried to create Project web app instances to test account display name issue. First I created a test project site as “Test-PWA” and when I finished the test I deleted it. Later I wanted to test it again and created the same site as “Test-PWA”, but at this time I got the error: “Sorry, something went wrong. An entry with the same key already exists.” and a correlation ID instead of the list about Projects on the “Manage Project Web Apps”.

ULS log also contained the error: Application error when access /_admin/pwa/managepwa.aspx, Error=An entry with the same key already exists.

The issue answered here by Michael Wharton, MVP.

“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()