gatsbyjs/gatsby · error

Internal server error.

Error message

Internal server error.

What it means

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.

Source

Thrown at packages/gatsby/src/commands/serve.ts:250

                for (const [name, value] of Object.entries(
                  data.serverDataHeaders
                )) {
                  res.setHeader(name, value)
                }
              }

              if (page.mode === `SSR` && data.serverDataStatus) {
                return void res.status(data.serverDataStatus).send(results)
              } else {
                return void res.send(results)
              }
            } catch (e) {
              report.error(
                `Generating page-data for "${requestedPagePath}" / "${potentialPagePath}" failed.`,
                e
              )
              return res
                .status(500)
                .contentType(`text/plain`)
                .send(`Internal server error.`)
            } finally {
              requestActivity.end()
            }
          }

          return void next()
        }
      )

      router.use(async (req, res, next) => {
        if (req.accepts(`html`)) {
          const potentialPagePath = req.path
          const page = findEnginePageByPath(potentialPagePath)
          if (page && (page.mode === `DSG` || page.mode === `SSR`)) {
            const requestActivity = report.phantomActivity(
              `request for "${req.path}"`

View on GitHub (pinned to e85d62f177)

Solutions

  1. Read the terminal output of `gatsby serve` — the underlying exception is logged by report.error right before this response is sent
  2. Run `gatsby build` to reproduce the page-data error with full stack traces
  3. Fix the throwing code in the page's pageQuery/render path (SSR pages run their getData at request time)
  4. Clear stale artifacts with `gatsby clean` and restart the server
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at packages/gatsby/src/commands/serve.ts:250 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


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