Make up a username that does not exist, e.g. notsarken, and attempt to access the works pages for one of its pseuds, e.g. https://test.archiveofourown.org/users/notsarken/pseuds/notsarken/works
Currently, going to the works page for a username that does not exist, e.g. https://test.archiveofourown.org/users/notsarken/works, shows a Recent Works listing at that URL instead. This should also be a 404.
A 500 error
A 404 error
There are constantly about 10 million of these errors in New Relic. The relevant bit of the error:
The error doesn't happen if you try to go to the works page for a nonexistent pseud for an existing user, e.g. https://test.archiveofourown.org/users/sarken/pseuds/fakepseud/works. If you do that, it just takes you to the user's works page.