{"record":{"id":"82c1c532e418c170","repo":"vercel/next.js","slug":"invalid-usage-of-next-script-did-you-forget-to-in","errorCode":null,"errorMessage":"Invalid usage of next/script. Did you forget to include a src attribute or an inline script? https://nextjs.org/docs/messages/invalid-script","messagePattern":"Invalid usage of next/script\\. Did you forget to include a src attribute or an inline script\\? https://nextjs\\.org/docs/messages/invalid-script","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/next/src/pages/_document.tsx","lineNumber":286,"sourceCode":"            dangerouslySetInnerHTML &&\n            dangerouslySetInnerHTML.__html\n          ) {\n            // Embed inline script if provided with dangerouslySetInnerHTML\n            srcProps.dangerouslySetInnerHTML = {\n              __html: dangerouslySetInnerHTML.__html,\n            }\n          } else if (scriptChildren) {\n            // Embed inline script if provided with children\n            srcProps.dangerouslySetInnerHTML = {\n              __html:\n                typeof scriptChildren === 'string'\n                  ? scriptChildren\n                  : Array.isArray(scriptChildren)\n                    ? scriptChildren.join('')\n                    : '',\n            }\n          } else {\n            throw new Error(\n              'Invalid usage of next/script. Did you forget to include a src attribute or an inline script? https://nextjs.org/docs/messages/invalid-script'\n            )\n          }\n\n          return (\n            <script\n              {...srcProps}\n              {...scriptProps}\n              type=\"text/partytown\"\n              key={src || index}\n              nonce={props.nonce}\n              data-nscript=\"worker\"\n              crossOrigin={props.crossOrigin || crossOrigin}\n            />\n          )\n        })}\n      </>\n    )","sourceCodeStart":268,"sourceCodeEnd":304,"githubUrl":"https://github.com/vercel/next.js/blob/0eb377541648e63402a47b38fee00a8d0ce8f8f1/packages/next/src/pages/_document.tsx#L268-L304","documentation":"getPreNextWorkerScripts (Partytown worker script handling in _document) validates each worker-context next/script before embedding: when a script has neither a src prop nor inline content via children or dangerouslySetInnerHTML there is nothing to load, so it throws with this error.","triggerScenarios":"next/script is used in _document without src or inline content.","commonSituations":"A Script tag in pages/_document missing both the src attribute and inline script.","solutions":["Add a src attribute or inline script content to next/script."],"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-14T05:17:10.506Z"}