{"record":{"id":"738b3747b49423c3","repo":"gatsbyjs/gatsby","slug":"head-title-failed-to-server-render-ssr-title","errorCode":null,"errorMessage":"<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>","messagePattern":"<head><title>Failed to Server Render \\(SSR\\)</title></head><body><h1>Failed to Server Render \\(SSR\\)</h1><h2>Error message:</h2><p>(.+?)</p><h2>File:</h2><p>(.+?):(.+?):(.+?)</p><h2>Stack:</h2><pre><code>(.+?)</code></pre></body>","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"packages/gatsby/src/utils/start-server.ts","lineNumber":773,"sourceCode":"          res.send(clientOnlyShell)\n        } catch (e) {\n          report.error({\n            id: `11616`,\n            context: {\n              sourceMessage: e.message,\n            },\n            filePath: e.filename,\n            location: {\n              start: {\n                line: e.line,\n                column: e.column,\n              },\n            },\n          })\n\n          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>`\n\n          res.send(minimalHTML).status(500)\n        }\n      }\n\n      htmlActivity.end()\n\n      return null\n    })\n  }\n\n  if (\n    process.env.GATSBY_QUERY_ON_DEMAND &&\n    process.env.GATSBY_QUERY_ON_DEMAND_LOADING_INDICATOR === `true`\n  ) {\n    routeLoadingIndicatorRequests(app)\n  }\n\n  app.use(async (req, res) => {\n    // in this catch-all block we don't support POST so we should 404","sourceCodeStart":755,"sourceCodeEnd":791,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/e85d62f1779e353eaac1753211629a26d123e26c/packages/gatsby/src/utils/start-server.ts#L755-L791","documentation":"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.","triggerScenarios":"Thrown at packages/gatsby/src/utils/start-server.ts:773 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"fallback","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"}