I have an e50 with the 0x0501 error message, which happened after it was in my backpack for a while, the lens was indeed jammed - fixed it by gently adjusting the lenses when they were extended. On mine, the outer lens housing was slightly canted, by evening it out with a bit of force, it snapped back into place and works fine now!
I did what Peter Jamieson said after also having it down the beach and it worked a treat.Gently wiggled the two external circular pieces that the lens sits in and blew and shook a bit to get rid of what was jamming the mechanism.
if the camera is still under warranty and its not caused by accidental damage the camera will be repaired, if you havent got the receipt the contact the company you brought the item from they should have a copy of the receipt on their system. the number for pentax is 01753 792 792 (uk number)