I recently ran into the following error while trying to upgrade SharePoint 2016:
Exception: Microsoft.SharePoint.Upgrade.SPUpgradeException: Action 126.96.36.199 of Microsoft.SharePoint.Upgrade.SPIisWebSiteWssSequence failed. —> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.SharePoint.Upgrade.RemoveAppDataWebConfig.RemoveAppDataEntries(XmlDocument webConfig)….
This update was being run on a farm server that had previously hosted the Central Administration application. When CA had been moved to the new server, the previous CA installation had not been removed yet. Simply running Remove-SPCentralAdministration within a SP Management Shell (likely As Administrator) on the “old” server successfully removed the unused CA installation and allowed the SharePoint upgrade to complete successfully.