vercel/next.js · error

Your custom Document (pages/_document) did not render all th

Error message

Your custom Document (pages/_document) did not render all the required subcomponent${plural}.
Missing component${plural}: ${missingComponentList}
Read how to fix here: https://nextjs.org/docs/messages/missing-document-component

What it means

Error "Your custom Document (pages/_document) did not render all the required subcomponent${plural}. Missing component${plural}: ${missingComponentList} Read how to fix here: https://nextjs.org/docs/messages/missing-document-component" thrown in vercel/next.js.

Source

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

    async () => renderToString(document)
  )

  if (process.env.NODE_ENV !== 'production') {
    const nonRenderedComponents = []
    const expectedDocComponents = ['Main', 'Head', 'NextScript', 'Html']

    for (const comp of expectedDocComponents) {
      if (!(docComponentsRendered as any)[comp]) {
        nonRenderedComponents.push(comp)
      }
    }

    if (nonRenderedComponents.length) {
      const missingComponentList = nonRenderedComponents
        .map((e) => `<${e} />`)
        .join(', ')
      const plural = nonRenderedComponents.length !== 1 ? 's' : ''
      console.warn(
        `Your custom Document (pages/_document) did not render all the required subcomponent${plural}.\n` +
          `Missing component${plural}: ${missingComponentList}\n` +
          'Read how to fix here: https://nextjs.org/docs/messages/missing-document-component'
      )
    }
  }

  const [renderTargetPrefix, renderTargetSuffix] = documentHTML.split(
    '<next-js-internal-body-render-target></next-js-internal-body-render-target>',
    2
  )

  let prefix = ''
  if (!documentHTML.startsWith(DOCTYPE)) {
    prefix += DOCTYPE
  }
  prefix += renderTargetPrefix

View on GitHub (pinned to 89d017eac4)

Solutions

  1. Render all required Document subcomponents (Html, Head, Main, NextScript) in pages/_document.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/next/src/server/render.tsx:1585 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/f189970257be6b82. Report an issue: GitHub.