When building web applications should error pages (400, 500 status codes) be static .html files or is it fine to serve up dynamic pages and why?
I would think that if your server goes down, your dynamic pages would go down with it. At least with static pages, your load balancer could serve up static files.
As far as the HTTP protocol is concerned, there is no difference between a static and a dynamic page, so standards wise, there is no problem in serving up a dynamic page for a 400 and 500.
However, as you say, if there is an error in your application, then trying to serve up a dynamic page is probably not the best idea as it will possibly fail due to the same error, or even exacerbate the problem if the error is due to database congestion etc.