I lost 3 hours of my life to a stupid collision of template ID’s. Creating a site collection or child web based on one of my custom templates kept failing with the following UI error message
"The template you have chosen is invalid or cannot be found."
The SharePoint logs were less than helpful:
02/15/2009 14:32:22.97 output.exe (0x10CC) 0x1E14 Windows SharePoint Services General 72k2 High Failed to apply template "xxxxxx#0" to web at URL http://xxxxxx/sites/test2, error The template you have chosen is invalid or cannot be found. 0x81071e44
02/15/2009 14:32:22.97 output.exe (0x10CC) 0x1E14 Windows SharePoint Services General 8kh7 High The template you have chosen is invalid or cannot be found.
Solution:
Make sure all of the site definition configurations located in %programfiles%\Common Files\microsoft shared\Web Server Extensions\12\TEMPLATE\1033\XML have a unique IDs. Microsoft suggests ID values above 10000 to avoid conflicts with future Microsoft supplied site definitions (http://msdn.microsoft.com/en-us/library/ms441616.aspx). Most custom site definitions therefore use 10001 and if two site definitions have the same ID you wind up wasting several hours trying to figure out why it’s not provisioning your site definition.