The current error checking logic means that if there is an error in rendering a page, the page is automatically redirected to the 404 page (which is supposed to always be present).
But if the 404 template or metadata has any errors, it will keep trying to render it, resulting in an infinite loop.
We should fix this.