This can be occurred for various reasons, in my case the task URL which was assigned to user A was being opened by user B and throws this error. As I was testing task assignment, in my default browser I was logged into Project Server with Admin account, so clicking on the link in an email opens the page with this error. Opening the same URL in another browser or with the assignee’s logged in, it works.
This seems to be an unhandled exception. If someone comes up here looking for a solution, just make sure you do not have this case.