gatsbyjs/gatsby · error
<head><title>Failed to Server Render (SSR)</title></head><bo
Error message
<head><title>Failed to Server Render (SSR)</title></head><body><h1>Failed to Server Render (SSR)</h1><h2>Error message:</h2><p>${e.message}</p><h2>File:</h2><p>${e.filename}:${e.line}:${e.column}</p><h2>Stack:</h2><pre><code>${e.stack}</code></pre></body> What it means
Error "<head><title>Failed to Server Render (SSR)</title></head><body><h1>Failed to Server Render (SSR)</h1><h2>Error message:</h2><p>${e.message}</p><h2>File:</h2><p>${e.filename}:${e.line}:${e.column}</p><h2>Stack:</h2><pre><code>${e.stack}</code></pre></body>" thrown in gatsbyjs/gatsby.
Source
Thrown at packages/gatsby/src/utils/start-server.ts:773
res.send(clientOnlyShell)
} catch (e) {
report.error({
id: `11616`,
context: {
sourceMessage: e.message,
},
filePath: e.filename,
location: {
start: {
line: e.line,
column: e.column,
},
},
})
const minimalHTML = `<head><title>Failed to Server Render (SSR)</title></head><body><h1>Failed to Server Render (SSR)</h1><h2>Error message:</h2><p>${e.message}</p><h2>File:</h2><p>${e.filename}:${e.line}:${e.column}</p><h2>Stack:</h2><pre><code>${e.stack}</code></pre></body>`
res.send(minimalHTML).status(500)
}
}
htmlActivity.end()
return null
})
}
if (
process.env.GATSBY_QUERY_ON_DEMAND &&
process.env.GATSBY_QUERY_ON_DEMAND_LOADING_INDICATOR === `true`
) {
routeLoadingIndicatorRequests(app)
}
app.use(async (req, res) => {
// in this catch-all block we don't support POST so we should 404View on GitHub (pinned to e85d62f177)
Solutions
- Inspect the error message, file, line and stack included in the returned HTML to find the failing module
- Ensure the page component and its imports only use browser APIs inside useEffect/componentDidMount, not during SSR
- Verify all imports resolve in a Node context (no missing packages, no CSS/image imports in server-executed code without proper loader config)
- Reproduce with `gatsby build` for a cleaner stack trace, fix the error, and let the dev server hot-reload
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at packages/gatsby/src/utils/start-server.ts:773 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of gatsbyjs/gatsby@e85d62f177 (2026-08-26).
Data as JSON: /api/errors/738b3747b49423c3.
Report an issue: GitHub.