{"record":{"id":"b660af520c09f569","repo":"gatsbyjs/gatsby","slug":"internal-server-error","errorCode":null,"errorMessage":"Internal server error.","messagePattern":"Internal server error\\.","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"packages/gatsby/src/commands/serve.ts","lineNumber":250,"sourceCode":"                for (const [name, value] of Object.entries(\n                  data.serverDataHeaders\n                )) {\n                  res.setHeader(name, value)\n                }\n              }\n\n              if (page.mode === `SSR` && data.serverDataStatus) {\n                return void res.status(data.serverDataStatus).send(results)\n              } else {\n                return void res.send(results)\n              }\n            } catch (e) {\n              report.error(\n                `Generating page-data for \"${requestedPagePath}\" / \"${potentialPagePath}\" failed.`,\n                e\n              )\n              return res\n                .status(500)\n                .contentType(`text/plain`)\n                .send(`Internal server error.`)\n            } finally {\n              requestActivity.end()\n            }\n          }\n\n          return void next()\n        }\n      )\n\n      router.use(async (req, res, next) => {\n        if (req.accepts(`html`)) {\n          const potentialPagePath = req.path\n          const page = findEnginePageByPath(potentialPagePath)\n          if (page && (page.mode === `DSG` || page.mode === `SSR`)) {\n            const requestActivity = report.phantomActivity(\n              `request for \"${req.path}\"`","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/e85d62f1779e353eaac1753211629a26d123e26c/packages/gatsby/src/commands/serve.ts#L232-L268","documentation":"Generic 500 sent by `gatsby serve` when generating page-data for the requested page throws. The catch block around page-data rendering already logs the real cause via report.error (\"Generating page-data for ... failed\"); this HTML is just the fallback body for the HTTP response, not the actual error.","triggerScenarios":"Thrown at packages/gatsby/src/commands/serve.ts:250 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the terminal output of `gatsby serve` — the underlying exception is logged by report.error right before this response is sent","Run `gatsby build` to reproduce the page-data error with full stack traces","Fix the throwing code in the page's pageQuery/render path (SSR pages run their getData at request time)","Clear stale artifacts with `gatsby clean` and restart the server"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e85d62f1779e353eaac1753211629a26d123e26c","analyzedAt":"2026-08-26T17:50:09.662Z","contentChangedAt":"2026-08-26T17:50:09.662Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}