Migration Issue – Error in Upgrade Log: “Exception thrown while applying the global template to the web with URL “(unknown)” (Id: ”) from site with URL “(unknown)” (Id: ”). Adding web to the exceptions list. Exception: System.IO.FileNotFoundException: The site with the id could not be found.”

In my curent migration project I got this error in an Content Database upgrade log on the new SharePoint 2010 farm:

Template MPS#0: Exception thrown while applying the global template to the web with URL “(unknown)” (Id: ‘a98475b1-385d-4ac6-bc1b-226f2e35a27e’) from site with URL “(unknown)” (Id: ‘3e800bc3-296f-47f0-a04d-b1e4ae385cb8’). Adding web to the exceptions list. Exception: System.IO.FileNotFoundException: The site with the id 3e800bc3-296f-47f0-a04d-b1e4ae385cb8 could not be found.

Template <templateId>: Exception thrown while applying the global template to the web with URL “(unknown)” (Id: ‘<guid>‘) from site with URL “(unknown)” (Id: ‘<guid>’). Adding web to the exceptions list. Exception: System.IO.FileNotFoundException: The site with the id <guid> could not be found.

This is a piece of text of the upgrade log file:

 
[ScriptEditor] [SPWebTemplateSequence] [DEBUG] [12/8/2011 7:04:24 PM]: Template MPS#0: Exception thrown while applying the global template to the web with URL "(unknown)" (Id: 'e5c2cec5-7d3a-483b-ac55-0ca60a7ba432') from site with URL "(unknown)" (Id: '3e800bc3-296f-47f0-a04d-b1e4ae385cb8'). Adding web to the exceptions list. Exception: System.IO.FileNotFoundException: The site with the id 3e800bc3-296f-47f0-a04d-b1e4ae385cb8 could not be found.
   at Microsoft.SharePoint.SPSite..ctor(Guid id, SPFarm farm, SPUrlZone zone, SPUserToken userToken)
   at Microsoft.SharePoint.SPSite..ctor(Guid id)
   at Microsoft.SharePoint.Upgrade.SPWebTemplateSequence.ApplyGlobalTemplateToWebs(List`1 lstwebinfoToUpgrade, List`1& lstwebinfoExceptions)
[ScriptEditor] [SPWebTemplateSequence] [DEBUG] [12/8/2011 7:04:24 PM]: Template MPS#0: Exception thrown while applying the global template to the web with URL "(unknown)" (Id: 'a98475b1-385d-4ac6-bc1b-226f2e35a27e') from site with URL "(unknown)" (Id: '3e800bc3-296f-47f0-a04d-b1e4ae385cb8'). Adding web to the exceptions list. Exception: System.IO.FileNotFoundException: The site with the id 3e800bc3-296f-47f0-a04d-b1e4ae385cb8 could not be found.
   at Microsoft.SharePoint.SPSite..ctor(Guid id, SPFarm farm, SPUrlZone zone, SPUserToken userToken)
   at Microsoft.SharePoint.SPSite..ctor(Guid id)
   at Microsoft.SharePoint.Upgrade.SPWebTemplateSequence.ApplyGlobalTemplateToWebs(List`1 lstwebinfoToUpgrade, List`1& lstwebinfoExceptions)
[ScriptEditor] [SPWebTemplateSequence] [DEBUG] [12/8/2011 7:04:24 PM]: Template MPS#0: Exception thrown while applying the global template to the web with URL "(unknown)" (Id: '71f74b12-8ba9-4483-8554-38894878a620') from site with URL "(unknown)" (Id: '3e800bc3-296f-47f0-a04d-b1e4ae385cb8'). Adding web to the exceptions list. Exception: System.IO.FileNotFoundException: The site with the id 3e800bc3-296f-47f0-a04d-b1e4ae385cb8 could not be found.
   at Microsoft.SharePoint.SPSite..ctor(Guid id, SPFarm farm, SPUrlZone zone, SPUserToken userToken)
   at Microsoft.SharePoint.SPSite..ctor(Guid id)
   at Microsoft.SharePoint.Upgrade.SPWebTemplateSequence.ApplyGlobalTemplateToWebs(List`1 lstwebinfoToUpgrade, List`1& lstwebinfoExceptions)
[ScriptEditor] [SPWebTemplateSequence] [DEBUG] [12/8/2011 7:04:24 PM]: Template MPS#0: Exception thrown while applying the global template to the web with URL "(unknown)" (Id: '48b3e9f9-e9fa-4981-93ce-3dec85dc3ee7') from site with URL "(unknown)" (Id: '3e800bc3-296f-47f0-a04d-b1e4ae385cb8'). Adding web to the exceptions list. Exception: System.IO.FileNotFoundException: The site with the id 3e800bc3-296f-47f0-a04d-b1e4ae385cb8 could not be found.
   at Microsoft.SharePoint.SPSite..ctor(Guid id, SPFarm farm, SPUrlZone zone, SPUserToken userToken)
   at Microsoft.SharePoint.SPSite..ctor(Guid id)
   at Microsoft.SharePoint.Upgrade.SPWebTemplateSequence.ApplyGlobalTemplateToWebs(List`1 lstwebinfoToUpgrade, List`1& lstwebinfoExceptions)
[ScriptEditor] [SPWebTemplateSequence] [DEBUG] [12/8/2011 7:04:24 PM]: Template MPS#0: Exception thrown while applying the global template to the web with URL "(unknown)" (Id: '75ddba70-768c-435e-96a1-4491c61083b6') from site with URL "(unknown)" (Id: '3e800bc3-296f-47f0-a04d-b1e4ae385cb8'). Adding web to the exceptions list. Exception: System.IO.FileNotFoundException: The site with the id 3e800bc3-296f-47f0-a04d-b1e4ae385cb8 could not be found.
   at Microsoft.SharePoint.SPSite..ctor(Guid id, SPFarm farm, SPUrlZone zone, SPUserToken userToken)
   at Microsoft.SharePoint.SPSite..ctor(Guid id)
   at Microsoft.SharePoint.Upgrade.SPWebTemplateSequence.ApplyGlobalTemplateToWebs(List`1 lstwebinfoToUpgrade, List`1& lstwebinfoExceptions)
[ScriptEditor] [SPWebTemplateSequence] [DEBUG] [12/8/2011 7:04:24 PM]: Template MPS#0: Exception thrown while applying the global template to the web with URL "(unknown)" (Id: 'ebb027c8-56ec-4526-9962-514ef0b33f7a') from site with URL "(unknown)" (Id: '3e800bc3-296f-47f0-a04d-b1e4ae385cb8'). Adding web to the exceptions list. Exception: System.IO.FileNotFoundException: The site with the id 3e800bc3-296f-47f0-a04d-b1e4ae385cb8 could not be found.
   at Microsoft.SharePoint.SPSite..ctor(Guid id, SPFarm farm, SPUrlZone zone, SPUserToken userToken)
   at Microsoft.SharePoint.SPSite..ctor(Guid id)
   at Microsoft.SharePoint.Upgrade.SPWebTemplateSequence.ApplyGlobalTemplateToWebs(List`1 lstwebinfoToUpgrade, List`1& lstwebinfoExceptions)
[ScriptEditor] [SPWebTemplateSequence] [DEBUG] [12/8/2011 7:04:24 PM]: Template MPS#0: Exception thrown while applying the global template to the web with URL "(unknown)" (Id: 'bedbd386-98cd-4070-ab96-6dc5a58c2908') from site with URL "(unknown)" (Id: '3e800bc3-296f-47f0-a04d-b1e4ae385cb8'). Adding web to the exceptions list. Exception: System.IO.FileNotFoundException: The site with the id 3e800bc3-296f-47f0-a04d-b1e4ae385cb8 could not be found.
   at Microsoft.SharePoint.SPSite..ctor(Guid id, SPFarm farm, SPUrlZone zone, SPUserToken userToken)
   at Microsoft.SharePoint.SPSite..ctor(Guid id)
   at Microsoft.SharePoint.Upgrade.SPWebTemplateSequence.ApplyGlobalTemplateToWebs(List`1 lstwebinfoToUpgrade, List`1& lstwebinfoExceptions)
[ScriptEditor] [SPWebTemplateSequence] [DEBUG] [12/8/2011 7:04:24 PM]: Template MPS#0: Exception thrown while applying the global template to the web with URL "(unknown)" (Id: '22a173d5-68e3-40a4-b749-71f5c26a57d7') from site with URL "(unknown)" (Id: '3e800bc3-296f-47f0-a04d-b1e4ae385cb8'). Adding web to the exceptions list. Exception: System.IO.FileNotFoundException: The site with the id 3e800bc3-296f-47f0-a04d-b1e4ae385cb8 could not be found.
   at Microsoft.SharePoint.SPSite..ctor(Guid id, SPFarm farm, SPUrlZone zone, SPUserToken userToken)
   at Microsoft.SharePoint.SPSite..ctor(Guid id)
   at Microsoft.SharePoint.Upgrade.SPWebTemplateSequence.ApplyGlobalTemplateToWebs(List`1 lstwebinfoToUpgrade, List`1& lstwebinfoExceptions)
[ScriptEditor] [SPWebTemplateSequence] [DEBUG] [12/8/2011 7:04:24 PM]: Template MPS#0: Exception thrown while applying the global template to the web with URL "(unknown)" (Id: 'b4e93fdf-9412-44ad-9402-77f215534d88') from site with URL "(unknown)" (Id: '3e800bc3-296f-47f0-a04d-b1e4ae385cb8'). Adding web to the exceptions list. Exception: System.IO.FileNotFoundException: The site with the id 3e800bc3-296f-47f0-a04d-b1e4ae385cb8 could not be found.
   at Microsoft.SharePoint.SPSite..ctor(Guid id, SPFarm farm, SPUrlZone zone, SPUserToken userToken)
   at Microsoft.SharePoint.SPSite..ctor(Guid id)
   at Microsoft.SharePoint.Upgrade.SPWebTemplateSequence.ApplyGlobalTemplateToWebs(List`1 lstwebinfoToUpgrade, List`1& lstwebinfoExceptions)
[ScriptEditor] [SPWebTemplateSequence] [DEBUG] [12/8/2011 7:04:24 PM]: Template MPS#0: Exception thrown while applying the global template to the web with URL "(unknown)" (Id: 'be229958-2680-4d85-ba72-79f036ab075a') from site with URL "(unknown)" (Id: '3e800bc3-296f-47f0-a04d-b1e4ae385cb8'). Adding web to the exceptions list. Exception: System.IO.FileNotFoundException: The site with the id 3e800bc3-296f-47f0-a04d-b1e4ae385cb8 could not be found.
   at Microsoft.SharePoint.SPSite..ctor(Guid id, SPFarm farm, SPUrlZone zone, SPUserToken userToken)
   at Microsoft.SharePoint.SPSite..ctor(Guid id)
   at Microsoft.SharePoint.Upgrade.SPWebTemplateSequence.ApplyGlobalTemplateToWebs(List`1 lstwebinfoToUpgrade, List`1& lstwebinfoExceptions)
[ScriptEditor] [SPWebTemplateSequence] [DEBUG] [12/8/2011 7:04:24 PM]: Template MPS#0: Exception thrown while applying the global template to the web with URL "(unknown)" (Id: '79ae9a08-845b-4502-affe-a836b7783ae8') from site with URL "(unknown)" (Id: '3e800bc3-296f-47f0-a04d-b1e4ae385cb8'). Adding web to the exceptions list. Exception: System.IO.FileNotFoundException: The site with the id 3e800bc3-296f-47f0-a04d-b1e4ae385cb8 could not be found.
   at Microsoft.SharePoint.SPSite..ctor(Guid id, SPFarm farm, SPUrlZone zone, SPUserToken userToken)
   at Microsoft.SharePoint.SPSite..ctor(Guid id)
   at Microsoft.SharePoint.Upgrade.SPWebTemplateSequence.ApplyGlobalTemplateToWebs(List`1 lstwebinfoToUpgrade, List`1& lstwebinfoExceptions)
[ScriptEditor] [SPWebTemplateSequence] [DEBUG] [12/8/2011 7:04:24 PM]: Template MPS#0: Exception thrown while applying the global template to the web with URL "(unknown)" (Id: '27a97c8e-3652-4fe2-9fe2-ca8d47eca28d') from site with URL "(unknown)" (Id: '3e800bc3-296f-47f0-a04d-b1e4ae385cb8'). Adding web to the exceptions list. Exception: System.IO.FileNotFoundException: The site with the id 3e800bc3-296f-47f0-a04d-b1e4ae385cb8 could not be found.
   at Microsoft.SharePoint.SPSite..ctor(Guid id, SPFarm farm, SPUrlZone zone, SPUserToken userToken)
   at Microsoft.SharePoint.SPSite..ctor(Guid id)
   at Microsoft.SharePoint.Upgrade.SPWebTemplateSequence.ApplyGlobalTemplateToWebs(List`1 lstwebinfoToUpgrade, List`1& lstwebinfoExceptions)
[ScriptEditor] [SPWebTemplateSequence] [DEBUG] [12/8/2011 7:04:24 PM]: Template MPS#0: Exception thrown while applying the global template to the web with URL "(unknown)" (Id: '4d755906-d3ca-4c23-b505-d7f0f5ef0a2c') from site with URL "(unknown)" (Id: '3e800bc3-296f-47f0-a04d-b1e4ae385cb8'). Adding web to the exceptions list. Exception: System.IO.FileNotFoundException: The site with the id 3e800bc3-296f-47f0-a04d-b1e4ae385cb8 could not be found.
   at Microsoft.SharePoint.SPSite..ctor(Guid id, SPFarm farm, SPUrlZone zone, SPUserToken userToken)
   at Microsoft.SharePoint.SPSite..ctor(Guid id)
   at Microsoft.SharePoint.Upgrade.SPWebTemplateSequence.ApplyGlobalTemplateToWebs(List`1 lstwebinfoToUpgrade, List`1& lstwebinfoExceptions)
[ScriptEditor] [SPWebTemplateSequence] [DEBUG] [12/8/2011 7:04:24 PM]: Template MPS#0: Exception thrown while applying the global template to the web with URL "(unknown)" (Id: '8cc79a95-c567-4b8d-902e-ed944d64d84d') from site with URL "(unknown)" (Id: '3e800bc3-296f-47f0-a04d-b1e4ae385cb8'). Adding web to the exceptions list. Exception: System.IO.FileNotFoundException: The site with the id 3e800bc3-296f-47f0-a04d-b1e4ae385cb8 could not be found.
   at Microsoft.SharePoint.SPSite..ctor(Guid id, SPFarm farm, SPUrlZone zone, SPUserToken userToken)
   at Microsoft.SharePoint.SPSite..ctor(Guid id)
   at Microsoft.SharePoint.Upgrade.SPWebTemplateSequence.ApplyGlobalTemplateToWebs(List`1 lstwebinfoToUpgrade, List`1& lstwebinfoExceptions)
[ScriptEditor] [SPWebTemplateSequence] [DEBUG] [12/8/2011 7:04:24 PM]: Template MPS#0: Exception thrown while applying the global template to the web with URL "(unknown)" (Id: 'ec8f2991-c91a-41af-84be-fef8597035a2') from site with URL "(unknown)" (Id: '3e800bc3-296f-47f0-a04d-b1e4ae385cb8'). Adding web to the exceptions list. Exception: System.IO.FileNotFoundException: The site with the id 3e800bc3-296f-47f0-a04d-b1e4ae385cb8 could not be found.
   at Microsoft.SharePoint.SPSite..ctor(Guid id, SPFarm farm, SPUrlZone zone, SPUserToken userToken)
   at Microsoft.SharePoint.SPSite..ctor(Guid id)
   at Microsoft.SharePoint.Upgrade.SPWebTemplateSequence.ApplyGlobalTemplateToWebs(List`1 lstwebinfoToUpgrade, List`1& lstwebinfoExceptions)

Solution in my case:

There was an incorrect managed path in the web applications configured. The managed path was available, but set to “Wildcard inclusion” in the new farm (2010) instead of “Explicit inclusion” as in the old farm (2007).

I did remove the managed path and added it again with the correct setting. After that I had to re-attach the content database. The error was gone.