Fix Template Does Not Exist Error Snippet
When I was experimenting with creating pages dynamically, I broke my Main.Webhome! This is caused by an issue when you create a malformed doc. I had used $doc.setDefaultTempate() to try and set the template. this ended up making my main page not show up. to fix this open up you database (following example for mysql), and run the following query:
UPDATE xwikidoc SET XWD_DEFAULT_TEMPLATE = "" WHERE XWD_FULLNAME = "Main.WebHome";
you can also do this using velocity code on a page
{{velocity}}
#set($mainDoc = $xwiki.getDocument("Main.WebHome"))
$mainDoc.setDefaultTemplate("")
$mainDoc.save()
{{/velocity}}