I started getting this error while deploying the site definition solution in SharePoint ( it was visual studio 2008) . I also had a web application in the same solution.
I removed that web application and then it got deployed without any error. However that web application was there earlier as well but it wasn’t giving error before. Not sure what exactly caused the error.
Anyways, I hope it would be useful !