vercel/next.js · error

The /404 page can not return notFound in "getStaticProps", p

Error message

The /404 page can not return notFound in "getStaticProps", please remove it to continue!

What it means

Guard in renderToHTMLImpl's data-validation branch: the response object contained notFound: true while the page being rendered is /404 itself. Returning notFound from the 404 page's own data fetching would recurse infinitely, so the validator rejects it and asks for its removal.

Source

Thrown at packages/next/src/server/render.tsx:1168

    if ((data as any).unstable_notFound) {
      throw new Error(
        `unstable_notFound has been renamed to notFound, please update the field to continue. Page: ${pathname}`
      )
    }
    if ((data as any).unstable_redirect) {
      throw new Error(
        `unstable_redirect has been renamed to redirect, please update the field to continue. Page: ${pathname}`
      )
    }

    if (invalidKeys.length) {
      throw new Error(invalidKeysMsg('getServerSideProps', invalidKeys))
    }

    if ('notFound' in data && data.notFound) {
      if (pathname === '/404') {
        throw new Error(
          `The /404 page can not return notFound in "getStaticProps", please remove it to continue!`
        )
      }

      metadata.isNotFound = true
      return new RenderResult(null, {
        metadata,
        contentType: null,
      })
    }

    if ('redirect' in data && typeof data.redirect === 'object') {
      checkRedirectValues(data.redirect as Redirect, req, 'getServerSideProps')
      ;(data as any).props = {
        __N_REDIRECT: data.redirect.destination,
        __N_REDIRECT_STATUS: getRedirectStatus(data.redirect),
      }
      if (typeof data.redirect.basePath !== 'undefined') {

View on GitHub (pinned to 89d017eac4)

Solutions

  1. Remove `notFound: true` from the /404 page's `getStaticProps`; the 404 page must always be statically renderable.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/next/src/server/render.tsx:1170 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of vercel/next.js@89d017eac4 (2026-08-19). Data as JSON: /api/errors/8b21708019dea65b. Report an issue: GitHub.