gatsbyjs/gatsby · error

<html><body><h1>500</h1><p>Internal Server Error</p></body><

Error message

<html><body><h1>500</h1><p>Internal Server Error</p></body></html>

What it means

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.

Source

Thrown at packages/gatsby/src/utils/page-ssr-module/lambda.ts:535

          req?.rawUrl ? new URL(req.rawUrl).origin : cdnDatastoreOrigin
        ),
      req,
    })

    if (isPageData) {
      const results = await renderPageData({ data })
      setStatusAndHeaders({ page, data, res })
      res.json(results)
      return
    } else {
      const results = await renderHTML({ data })
      setStatusAndHeaders({ page, data, res })
      res.send(results)
      return
    }
  } catch (e) {
    console.error(`Engine failed to handle request`, e)
    res.status(500).send(getErrorBody(500))
  }
}

export default engineHandler

View on GitHub (pinned to 8cffb8f412)

Solutions

  1. Inspect the logged engine error and stack for the failing page
  2. Re-run the page's query locally to reproduce
  3. Fix the SSR/rendering error in the page component
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at packages/gatsby/src/utils/page-ssr-module/lambda.ts:517 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of gatsbyjs/gatsby@8cffb8f412 (2026-08-26). Data as JSON: /api/errors/a7dee09ee63b8554. Report an issue: GitHub.