quasarframework/quasar · error

Render failed

Error message

Render failed

What it means

Warning logged by the SSG dev server (configureServer) when an SSR render of a request fails during `quasar dev -m ssg`. It prints the failing req.url as 'Render failed', then builds an error page via renderSSRError (500 | Internal Server Error due to redirect in SSG mode for redirect-type errors) and serves it to the browser. This affects the dev server only, not production builds.

Source

Thrown at app-vite/lib/modes/ssg/ssg-devserver.js:294

                res.writeHead(404)
                res.end('404 | Page Not Found')
                return
              }

              if (err?.redirectUrl) {
                /**
                 * We were told to redirect to another URL,
                 * but we're in SSG mode, so we cannot!
                 */
                res.writeHead(500)
                res.end(
                  '500 | Internal Server Error due to redirect in SSG mode'
                )
                return
              }

              log()
              warn(req.url, 'Render failed')

              const { errorHeaders, errorHtml } = renderSSRError({
                err:
                  err instanceof Error
                    ? err
                    : new Error(String(err) || 'Unknown error'),
                req,
                rootFolder
              })

              res.writeHead(500, errorHeaders)
              res.end(errorHtml)
            }
          })
        }
      }
    })

View on GitHub (pinned to 4841521b5f)

Solutions

  1. If the cause is a redirect: remove the server-side redirect (route guard navigation) or guard it with process.env.CLIENT, since redirects are not supported in SSG mode.
  2. Inspect the accompanying error (err is passed to renderSSRError and rendered) to find the throwing code path.
  3. Fix SSR-unsafe APIs in the page for the failing URL.
  4. Reproduce the exact URL locally and test after fixing; dev server will hot-reload.

Example fix

// before
if (!auth.user) { return next('/login') }
// after
if (process.env.CLIENT && !auth.user) { return next('/login') }
Defensive patterns

Strategy: try-catch

Validate before calling

// Guard redirects so they only run on the client (SSG dev forbids SSR redirects)
router.beforeEach((to) => {
  if (process.env.CLIENT && !auth.user && to.path !== '/login') return '/login'
})

Type guard

function isClient(): boolean {
  return typeof window !== 'undefined'
}

Try / catch

try {
  const html = await renderApp(req.url)
} catch (err) {
  console.error(`Render failed for ${req.url}:`, err)
  // in SSG dev mode this becomes a 500 page; fix the redirect or SSR-unsafe code
}

Prevention

When it happens

Trigger: During SSG dev mode, the SSR render middleware throws for a request — including render errors caused by redirects (which are disallowed in SSG mode, hence the '500 | Internal Server Error due to redirect in SSG mode' response path) or any other SSR exception; the catch handler logs the URL with the 'Render failed' tag.

Common situations: Calling router.push or returning a redirect from a route guard during SSR in SSG mode; a component throwing during server render; accessing browser-only APIs on the server in a dev page.

Related errors


AI-assisted analysis of quasarframework/quasar@4841521b5f (2026-08-30). Data as JSON: /api/errors/45d9464cacb82499. Report an issue: GitHub.