PSConfix.exe failed in SharePoint 2019 today. Below are some entries from the ULS logs.
Error messages in console:
Failed to upgrade SharePoint Products
An exception of type Microsoft.SharePoint.Upgrade.SPUpgradeException was thrown.
Upgrade logs ending with “–error “show :
07/03/2019 11:18:33.76 PSCONFIG (0x982C) 0x3CAC SharePoint Foundation Upgrade SPHierarchyManager ajyw5 INFO SPWebApplication Name=XYZEXT 00000000-0000-0000-0000-000000000000
07/03/2019 11:18:33.76 PSCONFIG (0x982C) 0x3CAC SharePoint Foundation Upgrade SPHierarchyManager ajyw5 ERROR Attempt to register null pointer at: at Microsoft.SharePoint.Upgrade.SPHierarchyManager.AddNextLevelObjects(Object current, IEnumerable nextObjects) at Microsoft.SharePoint.Upgrade.SPHierarchyManager.Grow(SPTree`1 root, Boolean bRecursing, SPDelegateManager delegateManager)
SPUpgradeSession an59w DEBUG Begin processing children of [SPWebApplication Name=XYZEXT] for upgrade.
SPWebApplicationSequence ajy60 DEBUG Web application [SPWebApplication Name=XYZEXT] has 1 IisSettings object
SPWebApplicationSequence ajy61 DEBUG Searching for sites with Server Comment = XYZEXT
SPWebApplicationSequence ajy66 DEBUG Adding a iis web site object with instance Id = [815745826]
SPHierarchyManager ajyw5 ERROR Attempt to register null pointer at: at Microsoft.SharePoint.Upgrade.SPHierarchyManager.AddNextLevelObjects(Object current, IEnumerable nextObjects) at Microsoft.SharePoint.Upgrade.SPHierarchyManager.Grow(SPTree`1 root, Boolean bRecursing, SPDelegateManager
Logs show it failed at “Begin processing children of [SPWebApplication Name=XYZEXT]“, most recent change we made last week was addition of few new content databases in to this web application. So started looking at the new content databases and noticed that “Manage Content Databases” in CA shows total of 25 databases
Another check was with
$WA=Get-SPWebApplication XYZEXT $WA.ContentDatabases.Count 26
Notice it shows 26 content databases in the Config database listed as content databases for this web application.
That was something new but now logs make little more sense at “Attempt to register null pointer at: at Microsoft.SharePoint.Upgrade.SPHierarchyManager.AddNextLevelObjects”
Since the results is coming from the Config database lets grab the ID of our web application and Log in to SQL and explore Config database.
$WA=Get-SPWebApplication XYZEXT $WA.Id Guid ---- 255ea172-62b5-4196-a335-c92ae4088b9b
In Config database I use the SQL query to see the information about the web application we grab the ID above.
SELECT * FROM [SP2019_Config].[dbo].[Objects] Where ID like '255ea172-62b5-4196-a335-c92ae4088b9b'
Output:
We need to look in to the properties of this object you can right click, copy and paste in note pad or use the following SQL query and click on the output to see the properties.
SELECT cast (Properties as xml ) FROM [SP2019_Config].[dbo].[Objects] Where ID like '255ea172-62b5-4196-a335-c92ae4088b9b'
Output:
Once click you will see all the databases associated with this web application and the content database with <fldtype=“null“ />. This seems like bad database refernce and causing our PSConfig to fail. You can check with ID no such database exist.
Grab that ID from here and let’s go back to the SharePoint PS. Delete this fake content database using the ID and run the PSConfig again.
To remove the bad content db ID:
Remove-SPContentDatabase 9a15bfd6-e5bd-4340-abec-e06e86fa60fe
Command above threw an error message, so I used reference of web application and same behavior but when check the count of databases associated with this web application it was 25 (instead of 26), which is correct number based on our initial test. I beleive it was deleted with the first command but you can use any of them.
Remove-SPContentDatabase 9a15bfd6-e5bd-4340-abec-e06e86fa60fe $WA=Get-SPWebApplication XYZEXT $WA.ContentDatabases.Delete("9a15bfd6-e5bd-4340-abec-e06e86fa60fe") $WA.ContentDatabases.Count
Go back to SQL and run the same query again you will see the content database with <fldtype=“null“ /> is gone now.
Hope this will help someone.