How to handle error 500 when loading/reloading

If the address bar has a hangover value from previous load or any path at all as part of the url the system presents with error 500 and large stack trace.

Is there anyway to prevent this other than changing the url in the address bar by manually removing any old path?