Skip to content

Invalid svelte:elements are not caught by svelte:boundary during SSR #17890

@WarningImHack3r

Description

@WarningImHack3r

Describe the bug

Rendering errors caused by invalid tags passed to <svelte:elements are not caught by the nearest <svelte:boundary> during SSR. They work fine on the client during CSR, but trigger a 500 on the server.

As boundaries now work on the server since 5.53.0, I was expecting this kind of error to be also caught. I don't know if there are other rendering errors that are also in this situation, or if invalid tags if the only rendering error that isn't properly caught

Invalid tags errors are correctly caught by the handleError hook inside hooks.server.ts, though.

Reproduction

SvelteLab

While it works when changing the element tag on the fly via the input field, refreshing the page with an invalid name hardcoded as the initial value of the $state triggers a 500

Logs

[500] GET /
Svelte error: dynamic_element_invalid_tag
`<svelte:element this="invalid_name">` is not a valid element name — the element will not be rendered
https://svelte.dev/e/dynamic_element_invalid_tag
    at Module.dynamic_element_invalid_tag (node_modules/svelte/src/internal/server/errors.js:47:16)
    at Module.element (node_modules/svelte/src/internal/server/index.js:93:27)
    at eval (src/lib/Counter.svelte:23:26)
    at Renderer.child (node_modules/svelte/src/internal/server/renderer.js:218:18)
    at Renderer.component (node_modules/svelte/src/internal/server/renderer.js:323:22)
    at Counter (src/lib/Counter.svelte:11:13)
    at eval (src/routes/+page.svelte:25:39)
    at Renderer.boundary (node_modules/svelte/src/internal/server/renderer.js:270:19)
    at eval (src/routes/+page.svelte:21:15)

System Info

SvelteLab

Severity

annoyance

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