vercel/next.js · error
Warning: ${err.message}
Error message
Warning: ${err.message} What it means
getPreNextWorkerScripts renders Partytown worker scripts inside a try/catch; when rendering fails with an error whose code is not MODULE_NOT_FOUND (i.e. something other than the partytown package simply missing), it logs the error message as a warning and returns null so the document still renders.
Source
Thrown at packages/next/src/pages/_document.tsx:307
}
return (
<script
{...srcProps}
{...scriptProps}
type="text/partytown"
key={src || index}
nonce={props.nonce}
data-nscript="worker"
crossOrigin={props.crossOrigin || crossOrigin}
/>
)
})}
</>
)
} catch (err) {
if (isError(err) && err.code !== 'MODULE_NOT_FOUND') {
console.warn(`Warning: ${err.message}`)
}
return null
}
}
function getPreNextScripts(context: HtmlProps, props: OriginProps) {
const { scriptLoader, disableOptimizedLoading, crossOrigin } = context
const webWorkerScripts = getPreNextWorkerScripts(context, props)
const beforeInteractiveScripts = (scriptLoader.beforeInteractive || [])
.filter((script) => script.src)
.map((file: ScriptProps, index: number) => {
const { strategy, ...scriptProps } = file
return (
<script
{...scriptProps}
key={scriptProps.src || index}View on GitHub (pinned to 0eb3775416)
Solutions
- Inspect the warning source in your custom Document code and address the reported error.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at packages/next/src/pages/_document.tsx:307 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of vercel/next.js@0eb3775416 (2026-08-19).
Data as JSON: /api/errors/5dc0175248862c22.
Report an issue: GitHub.