Synchronous throw in an awaited expression becomes `null.f`
Author: jkbz64Created Sep 15, 2026Updated Sep 15, 2026
Describe the bug
Synchronous throw errors out as cryptic null.f access instead of the original error in production.
Reproduction
<script>
let valid = $state(true);
function load() {
if (!valid) throw new Error("original error");
return Promise.resolve("ready");
}
</script>
<button onclick={() => (valid = false)}>invalidate</button>
<svelte:boundary>
<p>{await load()}</p>
{#snippet pending()}<p>pending</p>{/snippet}
{#snippet failed(error)}<p>{error.message}</p>{/snippet}
</svelte:boundary>compile with
{ generate: "client", dev: false, experimental: { async: true } }Mount it, wait for ready, and click invalidate.
- Expected: the boundary renders
original error. - Actual:
Cannot read properties of null (reading 'f')escapes the boundary, which keeps displayingready. - The same problem occurs if the initial promise is still pending.
- The example deliberately throws a normal
Error; no application code accesses a property ofnullorundefined.
This will NOT manifest in svelte playground because the playground uses dev: true.
Logs
System Info
N/ASeverity
annoyance
Source: sveltejs/svelte