SPUpdatedConcurrencyException: An update conflict has occurred, and you must re-try this action.

I frequently build and tear down PWA instances on my test servers.

Today on my Project Server 2013 farm, I had failed to provision PWA, deleted the attempted instance, and tried again to no avail.

Finally, I did a little research on the error I was seeing in the application event log. Here's the error:

Log Name:      Application
Source:        Microsoft-SharePoint Products-Project Server
Date:          4/22/2015 11:27:13 AM
Event ID:      6971
Task Category: Provisioning
Level:         Error
Keywords:      
User:          CONTOSO\farmadmin
Computer:      ACN12.contoso.com
Description:
Failed to provision site PWA with error: Microsoft.SharePoint.Administration.SPUpdatedConcurrencyException: An update conflict has occurred, and you must re-try this action. The object ProjectSite Name=dafb59b4-b9a1-452a-8c29-ef3dd4d89165 was updated by CONTOSO\farmadmin, in the OWSTIMER (7528) process, on machine ACN12.  View the tracing log for more information about the conflict.
   at Microsoft.SharePoint.Administration.SPConfigurationDatabase.StoreObject(SPPersistedObject obj, Boolean storeClassIfNecessary, Boolean ensure)
   at Microsoft.SharePoint.Administration.SPPersistedObject.BaseUpdate()
   at Microsoft.Office.Project.Server.Administration.PsiServiceApplication.CreateSite(ProjectProvisionSettings provset)
Event Xml:
<Event xmlns="https://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="Microsoft-SharePoint Products-Project Server" Guid="{B2178104-1B5B-4C20-8C8F-960678CED9E5}" />
    <EventID>6971</EventID>
    <Version>15</Version>
    <Level>2</Level>
    <Task>20</Task>
    <Opcode>0</Opcode>
    <Keywords>0x4000000000000000</Keywords>
    <TimeCreated SystemTime="2015-04-22T18:27:13.694924500Z" />
    <EventRecordID>36366</EventRecordID>
    <Correlation ActivityID="{E348FF9C-EEE3-4025-F5EC-982945132727}" />
    <Execution ProcessID="7528" ThreadID="6528" />
    <Channel>Application</Channel>
    <Computer>ACN12.contoso.com</Computer>
    <Security UserID="S-1-5-21-1367286249-1688242018-2069209289-1114" />
  </System>
  <EventData>
    <Data Name="string0">PWA</Data>
    <Data Name="string1">Microsoft.SharePoint.Administration.SPUpdatedConcurrencyException: An update conflict has occurred, and you must re-try this action. The object ProjectSite Name=dafb59b4-b9a1-452a-8c29-ef3dd4d89165 was updated by CONTOSO\farmadmin, in the OWSTIMER (7528) process, on machine ACN12.  View the tracing log for more information about the conflict.
   at Microsoft.SharePoint.Administration.SPConfigurationDatabase.StoreObject(SPPersistedObject obj, Boolean storeClassIfNecessary, Boolean ensure)
   at Microsoft.SharePoint.Administration.SPPersistedObject.BaseUpdate()
   at Microsoft.Office.Project.Server.Administration.PsiServiceApplication.CreateSite(ProjectProvisionSettings provset)</Data>
  </EventData>
</Event>

There is a PWA instance conflict in the SharePoint farm.

How do I fix this? Why, using PowerShell, of course.  The commands below will tell you about the PWA instances you have and you must run these in order to fix the problem.

$ServiceApp = Get-SPServiceApplication | ? {$_.typename -like "*Project*"}
$PWA = $ServiceApp.SiteCollection
$PWA

The output will look like this:

WebAppUsername                  : CONTOSO\farmadmin
ProjectServiceDatabase          : ProjectDatabase
                                                  Name=12_ProjectWebApp
EventHandlersVersion            : 2e15aa5f-18e9-e411-9b16-001dd8b7fb50
WebAppId                               : 69c4cfbb-1108-4196-b6e7-27c26e95c12c
SiteId                                       : 536f4117-70b7-4565-9c8e-eaf5e017c1b6
AdminName                             : i:0#.w|contoso\farmadmin
Lcid                                        : 1033
Tag                                         :
IsServiceDatabaseInReadOnlyMode : False
IsUpdating                               : False
IsDeleted                                : False
IsOnline                                 : True
ProvisioningResult                : Successful
LogLevelManagerChangeNumber     : 0
CanRenameOnRestore          : False
CanSelectForBackup             : True
CanSelectForRestore            : True
DiskSizeRequired                  : 0
Name                                     : Project - 8080:PWA
CanUpgrade                          : True
IsBackwardsCompatible        : True
NeedsUpgradeIncludeChildren     : False
NeedsUpgrade                      : False
UpgradeContext                    : Microsoft.SharePoint.Upgrade.SPUpgradeContext
TypeName                             : Microsoft.Office.Project.Server.Administration.ProjectSite
DisplayName                         : 536f4117-70b7-4565-9c8e-eaf5e017c1b6
Id                                           : 9599f1e3-cb27-4332-97bd-30006705ea67
Status                                    : Online
Parent                                    : PsiServiceApplication Name=Project Server Service Application
Version                                 : 10603
Properties                             : {}
Farm                                     : SPFarm Name=SharePoint_Config_2013
UpgradedPersistedProperties     : {}

In the error message, look for the the part that says "The object ProjectSite Name=dafb59b4-b9a1-452a-8c29-ef3dd4d89165"

Take the guid from your error message and run the below query using your value.

$ServiceApp.SiteCollection.Remove("Replaced with ID")

For me, this meant I had to run:

$ServiceApp.SiteCollection.Remove("dafb59b4-b9a1-452a-8c29-ef3dd4d89165")

After doing so, I was able to provision PWA successfully.