Skip to content

Error page rendered for an SSR render error is missing its CSS #17406

Description

@VastBlast

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

  1. npm run build && npm run preview
  2. View source of /: no stylesheet link for the error page's CSS, so the heading is unstyled until the client loads.
  3. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions