Next.js Discord

Discord Forum

Custom error/404 page on pages router does not override default error/404 page

Unanswered
European Starling posted this in #help-forum
Open in Discord
Avatar
European StarlingOP
Same question asked here https://stackoverflow.com/questions/77975436/custom-404-page-wont-overrule-default-404-page-in-next-pages-router

doing exactly what the docs say (https://nextjs.org/docs/pages/building-your-application/routing/custom-error) and yet incorrect route always gives the default 404 page rather than the pages/404.tsx file that I made. Going to /404 shows it.

Renaming it to not-found.tsx stops the default one being shown but breaks the page. I think 'not-found' is something for the app router (https://nextjs.org/docs/app/api-reference/file-conventions/not-found) rather than pages router so probably not correct thing to do but makes me suspicious that nextjs isn't doing what it's supposed to.

1 Reply

Avatar
European StarlingOP
downgrading next from 14 to 12 fixed it. however, this is not a solution. I think NextJS themselves need to fix this bug.