If side-effects are unavoidable, use [`$effect`]($effect) instead.
### svelte_boundary_reset_onerror
```
A `<svelte:boundary>``reset` function cannot be called while an error is still being handled
```
If a [`<svelte:boundary>`](https://svelte.dev/docs/svelte/svelte-boundary) has an `onerror` function, it must not call the provided `reset` function synchronously since the boundary is still in a broken state. Typically, `reset()` is called later, once the error has been resolved.
If it's possible to resolve the error inside the `onerror` callback, you must at least wait for the boundary to settle before calling `reset()`, for example using [`tick`](https://svelte.dev/docs/svelte/lifecycle-hooks#tick):
To fix it, either create callback props to communicate changes, or mark `person` as [`$bindable`]($bindable).
### reset_misuse
```
reset() was invoked and the `<svelte:boundary>` template threw during flush. Calling `reset` inside the `onerror` handler while the app state is still broken can cause the fresh template to crash during its first render; the error bypassed the <svelte:boundary> to avoid an infinite loop `error` → `reset` → `error`
```
When you call `reset()` Svelte tears down the template inside `<svelte:boundary>` and renders a fresh one. If the same bad state that caused the first error in the first place is still present, that fresh mount crashes immediately. To break a potential `error → reset → error` loop, Svelte lets such render-time errors bubble past the boundary.
Sometimes this happens because you might have called `reset` before the error was thrown (perhaps in the `onclick` handler of the button that will then trigger the error) or inside the `onerror` handler.
`reset()` should preferably be called **after** the boundary has entered its error state. A common pattern is to call it from a "Try again" button in the fallback UI.
If you need to call `reset` inside the `onerror` handler, ensure you fix the broken state first, *then* invoke `reset()`.
The examples below show do's and don'ts:
```svelte
<!-- ❌ Don't call reset before errors occur -->
<buttononclick={()=> {
showComponent = true;
if (reset) reset(); // Called before knowing if error will occur
}}>
Update
</button>
<svelte:boundary>
{#if showComponent}
<!-- ... -->
{/if}
</svelte:boundary>
```
```svelte
<!-- ❌ Don't call reset without fixing the problematic state -->
<svelte:boundaryonerror={()=> {
// Fix the problematic state first
reset(); // This will cause the error to be thrown again and bypass the boundary
}}>
<!-- ... -->
</svelte:boundary>
```
```svelte
<!-- ✅ Call reset from error UI -->
<svelte:boundary>
<!-- ... -->
{#snippet failed(error)}
<buttononclick={()=> {
// Fix the problematic state first
selectedItem = null;
userInput = '';
reset(); // Now safe to retry
}}>Try Again</button>
{/snippet}
</svelte:boundary>
```
```svelte
<!-- ✅ Or fix the problematic state first and call reset in the onerror for immediate recovery -->
<svelte:boundaryonerror={()=> {
componentState = initialComponentState; // Fix/reset the problematic state first
reset(); // Now the regular template will show without errors
If side-effects are unavoidable, use [`$effect`]($effect) instead.
## svelte_boundary_reset_onerror
> A `<svelte:boundary>``reset` function cannot be called while an error is still being handled
If a [`<svelte:boundary>`](https://svelte.dev/docs/svelte/svelte-boundary) has an `onerror` function, it must not call the provided `reset` function synchronously since the boundary is still in a broken state. Typically, `reset()` is called later, once the error has been resolved.
If it's possible to resolve the error inside the `onerror` callback, you must at least wait for the boundary to settle before calling `reset()`, for example using [`tick`](https://svelte.dev/docs/svelte/lifecycle-hooks#tick):
To fix it, either create callback props to communicate changes, or mark `person` as [`$bindable`]($bindable).
## reset_misuse
> reset() was invoked and the `<svelte:boundary>` template threw during flush. Calling `reset` inside the `onerror` handler while the app state is still broken can cause the fresh template to crash during its first render; the error bypassed the <svelte:boundary> to avoid an infinite loop `error` → `reset` → `error`
When you call `reset()` Svelte tears down the template inside `<svelte:boundary>` and renders a fresh one. If the same bad state that caused the first error in the first place is still present, that fresh mount crashes immediately. To break a potential `error → reset → error` loop, Svelte lets such render-time errors bubble past the boundary.
Sometimes this happens because you might have called `reset` before the error was thrown (perhaps in the `onclick` handler of the button that will then trigger the error) or inside the `onerror` handler.
`reset()` should preferably be called **after** the boundary has entered its error state. A common pattern is to call it from a "Try again" button in the fallback UI.
If you need to call `reset` inside the `onerror` handler, ensure you fix the broken state first, *then* invoke `reset()`.
The examples below show do's and don'ts:
```svelte
<!-- ❌ Don't call reset before errors occur -->
<buttononclick={()=> {
showComponent = true;
if (reset) reset(); // Called before knowing if error will occur
}}>
Update
</button>
<svelte:boundary>
{#if showComponent}
<!-- ... -->
{/if}
</svelte:boundary>
```
```svelte
<!-- ❌ Don't call reset without fixing the problematic state -->
<svelte:boundaryonerror={()=> {
// Fix the problematic state first
reset(); // This will cause the error to be thrown again and bypass the boundary
}}>
<!-- ... -->
</svelte:boundary>
```
```svelte
<!-- ✅ Call reset from error UI -->
<svelte:boundary>
<!-- ... -->
{#snippet failed(error)}
<buttononclick={()=> {
// Fix the problematic state first
selectedItem = null;
userInput = '';
reset(); // Now safe to retry
}}>Try Again</button>
{/snippet}
</svelte:boundary>
```
```svelte
<!-- ✅ Or fix the problematic state first and call reset in the onerror for immediate recovery -->
<svelte:boundaryonerror={()=> {
componentState = initialComponentState; // Fix/reset the problematic state first
reset(); // Now the regular template will show without errors
}}>
<!-- ... -->
</svelte:boundary>
```
## select_multiple_invalid_value
> The `value` property of a `<select multiple>` element should be an array, but it received a non-array value. The selection will be kept as is.
consterror=newError(`svelte_boundary_reset_onerror\nA \`<svelte:boundary>\`\`reset\` function cannot be called while an error is still being handled\nhttps://svelte.dev/e/svelte_boundary_reset_onerror`);
console.warn(`%c[svelte] svelte_boundary_reset_noop\n%cA \`<svelte:boundary>\`\`reset\` function only resets the boundary the first time it is called\nhttps://svelte.dev/e/svelte_boundary_reset_noop`,bold,normal);
console.warn(`%c[svelte] reset_misuse\n%creset() was invoked and the \`<svelte:boundary>\` template threw during flush. Calling \`reset\` inside the \`onerror\` handler while the app state is still broken can cause the fresh template to crash during its first render; the error bypassed the <svelte:boundary> to avoid an infinite loop \`error\` → \`reset\` → \`error\`\nhttps://svelte.dev/e/reset_misuse`,bold,normal);
console.warn(`%c[svelte] svelte_boundary_reset_noop\n%cA \`<svelte:boundary>\`\`reset\` function only resets the boundary the first time it is called\nhttps://svelte.dev/e/svelte_boundary_reset_noop`,bold,normal);