Here’s an error that caused a lot of frustration over the last couple of days:

   

Failed to apply template TemplateName.stp to web at URL SharePointSiteName, error The template you have chosen is invalid or cannot be found.

   

This is a typically vague SharePoint error message - could mean anything and usually is caused by something completely unrelated to the displayed message. After lots of searching and considering things like duplicate IDs, publishing feature conflicts, different SharePoint versions, differences between domain and local accounts, approval status, site heirarchy and various interactions with the custom code on the server we found the problem.

   

We were trying to use a list template as a site template. Both types of template are cab files with the extension .stp, and you can upload to either the site or list template galleries without any issues. The template shows up in the template list when you create a site. The error turned out to be exactly what the message said it was, while providing no useful information whatsoever. Some days I hate SharePoint..