If you’re faced with that error, you should know that it doesn’t mean anything except you have a problem. Lots of people have written posts about it, but most of their explanations are wrong. It just means that sharepoint didn’t like what you did somewhere in your masterpage, your page, your webpart, your user control or anything else.
For me, it was because I used the SPWeb.GetListFromUrl method to test if the user actually had access to a list. If it didn’t, I was just catching the exception thrown.
The problem is, sharepoint never behaves like it should. As soon as Sharepoint has thrown the Exception, I couldn’t save any parameters of the webpart.
By the way, I corrected my webpart by checking available lists in the SPWeb.Lists property.
Author Florent Clairambault