{"record":{"id":"6cae906f59de3892","repo":"vercel/next.js","slug":"warning-viewport-meta-tags-should-not-be-used-in","errorCode":null,"errorMessage":"Warning: viewport meta tags should not be used in _document.js's <Head>. https://nextjs.org/docs/messages/no-document-viewport-meta","messagePattern":"Warning: viewport meta tags should not be used in _document\\.js's <Head>\\. https://nextjs\\.org/docs/messages/no-document-viewport-meta","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/next/src/pages/_document.tsx","lineNumber":675,"sourceCode":"      head = cssPreloads.concat(otherHeadElements)\n    }\n    let children: React.ReactNode[] = React.Children.toArray(\n      this.props.children\n    ).filter(Boolean)\n    // show a warning if Head contains <title> (only in development)\n    if (process.env.NODE_ENV !== 'production') {\n      children = React.Children.map(children, (child: any) => {\n        const isReactHelmet = child?.props?.['data-react-helmet']\n        if (!isReactHelmet) {\n          if (child?.type === 'title') {\n            console.warn(\n              \"Warning: <title> should not be used in _document.js's <Head>. https://nextjs.org/docs/messages/no-document-title\"\n            )\n          } else if (\n            child?.type === 'meta' &&\n            child?.props?.name === 'viewport'\n          ) {\n            console.warn(\n              \"Warning: viewport meta tags should not be used in _document.js's <Head>. https://nextjs.org/docs/messages/no-document-viewport-meta\"\n            )\n          }\n        }\n        return child\n        // @types/react bug. Returned value from .map will not be `null` if you pass in `[null]`\n      })!\n      if (this.props.crossOrigin)\n        console.warn(\n          'Warning: `Head` attribute `crossOrigin` is deprecated. https://nextjs.org/docs/messages/doc-crossorigin-deprecated'\n        )\n    }\n\n    const files: DocumentFiles = getDocumentFiles(\n      this.context.buildManifest,\n      this.context.__NEXT_DATA__.page\n    )\n","sourceCodeStart":657,"sourceCodeEnd":693,"githubUrl":"https://github.com/vercel/next.js/blob/0eb377541648e63402a47b38fee00a8d0ce8f8f1/packages/next/src/pages/_document.tsx#L657-L693","documentation":"Development-only warning raised inside the custom Head component's render in pages/_document.tsx. It fires when the children of <Head> are inspected and a <meta name=\"viewport\"> element is found (children coming from react-helmet are exempt). _document is rendered once on the server for every page, so per-page viewport configuration there is wrong; it belongs in the App Router metadata viewport export or in pages via next/head in a page.","triggerScenarios":"Thrown at packages/next/src/pages/_document.tsx:675 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Move viewport meta tags to the page-level `next/head` (or viewport export in app dir) instead of _document."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0eb377541648e63402a47b38fee00a8d0ce8f8f1","analyzedAt":"2026-08-19T02:10:13.922Z","contentChangedAt":"2026-08-19T02:10:13.922Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}