Eg.
https://commons.wikimedia.org/wiki/Special:DeletedContributions?target=183.82.97.1+&namespace=
No such problem if the trailing spaces are added to username (non-IP).
The request is obviously incorrect, but it should not trigger such an error. Some data validation seem to be missing.