Describe the bug
When a component throws during SSR, the nearest +error.svelte is rendered through the error boundary, but its CSS is not added to the response. In production there's no <link rel="stylesheet"> for it, and in dev it's missing from <style data-sveltekit>. The error page is unstyled until the client loads.
The same +error.svelte rendered for an error thrown in load does get its CSS.
render_response collects stylesheets only from branch nodes (runtime/server/page/render.js), while load_error_components (runtime/server/page/index.js) loads only the error nodes' components, so their stylesheets/inline_styles are never included.
Reproduction
https://stackblitz.com/edit/sveltejs-kit-template-default-wipbve6z?file=src%2Froutes%2F%2Bpage.svelte
npm run build && npm run preview
- View source of
/: no stylesheet link for the error page's CSS, so the heading is unstyled until the client loads.
- View source of
/load-error: <link href="./_app/immutable/assets/1.[hash].css" rel="stylesheet"> is present.
npm run dev shows the same: .status is missing from <style data-sveltekit> on / but present on /load-error.
Logs
System Info
System:
OS: Linux
Binaries:
Node: 24
npm: 12
pnpm: 12
npmPackages:
@sveltejs/adapter-node: 6.0.0
@sveltejs/kit: 3.0.0
@sveltejs/vite-plugin-svelte: 7.3.1
svelte: 5.57.1
vite: 8.3.2
Severity
annoyance
Additional Information
No response
Describe the bug
When a component throws during SSR, the nearest
+error.svelteis rendered through the error boundary, but its CSS is not added to the response. In production there's no<link rel="stylesheet">for it, and in dev it's missing from<style data-sveltekit>. The error page is unstyled until the client loads.The same
+error.svelterendered for an error thrown inloaddoes get its CSS.render_responsecollects stylesheets only frombranchnodes (runtime/server/page/render.js), whileload_error_components(runtime/server/page/index.js) loads only the error nodes' components, so theirstylesheets/inline_stylesare never included.Reproduction
https://stackblitz.com/edit/sveltejs-kit-template-default-wipbve6z?file=src%2Froutes%2F%2Bpage.svelte
npm run build && npm run preview/: no stylesheet link for the error page's CSS, so the heading is unstyled until the client loads./load-error:<link href="./_app/immutable/assets/1.[hash].css" rel="stylesheet">is present.npm run devshows the same:.statusis missing from<style data-sveltekit>on/but present on/load-error.Logs
System Info
Severity
annoyance
Additional Information
No response