{"record":{"id":"a7dee09ee63b8554","repo":"gatsbyjs/gatsby","slug":"html-body-h1-500-h1-p-internal-server-error","errorCode":null,"errorMessage":"<html><body><h1>500</h1><p>Internal Server Error</p></body></html>","messagePattern":"<html><body><h1>500</h1><p>Internal Server Error</p></body></html>","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"packages/gatsby/src/utils/page-ssr-module/lambda.ts","lineNumber":535,"sourceCode":"          req?.rawUrl ? new URL(req.rawUrl).origin : cdnDatastoreOrigin\n        ),\n      req,\n    })\n\n    if (isPageData) {\n      const results = await renderPageData({ data })\n      setStatusAndHeaders({ page, data, res })\n      res.json(results)\n      return\n    } else {\n      const results = await renderHTML({ data })\n      setStatusAndHeaders({ page, data, res })\n      res.send(results)\n      return\n    }\n  } catch (e) {\n    console.error(`Engine failed to handle request`, e)\n    res.status(500).send(getErrorBody(500))\n  }\n}\n\nexport default engineHandler\n","sourceCodeStart":517,"sourceCodeEnd":540,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8cffb8f412653a717042ec4de85038b4f2edd5e8/packages/gatsby/src/utils/page-ssr-module/lambda.ts#L517-L540","documentation":"Top-level catch of engineHandler: rendering the page or page-data threw (query failure, SSR error, datastore issue). The error is logged as 'Engine failed to handle request' and a minimal HTML 500 body is sent so the CDN/platform sees a proper server error.","triggerScenarios":"Thrown at packages/gatsby/src/utils/page-ssr-module/lambda.ts:517 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the logged engine error and stack for the failing page","Re-run the page's query locally to reproduce","Fix the SSR/rendering error in the page component"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8cffb8f412653a717042ec4de85038b4f2edd5e8","analyzedAt":"2026-08-26T17:50:09.662Z","contentChangedAt":"2026-08-26T17:50:09.662Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}