Do you get this error while deploying solution with a Feature Event Receiver through Visual Studio 2010. Well, I did while deploying a custom timer job solution which has a feature receiver to activate and deactivate the timer job feature.
All I did immediately was that started googling as usual :D. Somewhere I got to know this error occurs if we have used SPContext class in our feature activate event receiver. But, when I checked my event receiver I did not use this class at all.
Then, I attached the solution to OWSTimer.exe and started debugging to trace the error. I then found that I have accessed the SPSite of the feature as its parent as shown below.
And the scope of the feature was “Web” as shown below.
The Parent property of a feature represents the object that represents the scope of the feature. So, in my case I have assigned the Parent property of the feature (Which is SPWeb object) to the SPSite object instead and thus the mismatch caused the error while deploying. I know that this is not a very intellectually found fix, but still there could be few people like me who would immediately start googling for a solution :D.