When we develop a web part, we definitely face errors. Unfortunately these errors may prevent you from loading the page. Instead, all you can see is an error! Helpful, I know!
Anyway, the problem is that we want to remove the web part from the page, but we can’t even edit the page at all.
Add this QueryString to the URL: ?Contents=1
You will then see the page as below. Now, you can close or delete the bad web part.
This works for SharePoint 2007 .. 2010 & 2013 but I’m not sure about earlier versions, but who still uses it anyway!
Hope that helps.