You added a custom /_error
page without adding a custom /404
page. Adding a custom /_error
typically opts your application out of having the automatic static optimization applied to the 404 page.
Add a pages/404.js
with the 404 page you would like to show.