{"record":{"id":"ede3eec7cf988e90","repo":"sveltejs/svelte","slug":"svelte-boundary-reset-onerror","errorCode":"svelte_boundary_reset_onerror","errorMessage":"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","messagePattern":"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","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/svelte/src/internal/client/errors.js","lineNumber":508,"sourceCode":"\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/state_unsafe_mutation`);\n\t}\n}\n\n/**\n * A `<svelte:boundary>` `reset` function cannot be called while an error is still being handled\n * @returns {never}\n */\nexport function svelte_boundary_reset_onerror() {\n\tif (DEV) {\n\t\tconst error = new Error(`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`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);\n\t}\n}","sourceCodeStart":490,"sourceCodeEnd":510,"githubUrl":"https://github.com/sveltejs/svelte/blob/20b341f10048cf1016a2028ac7eee5595cfef6a5/packages/svelte/src/internal/client/errors.js#L490-L510","documentation":"Thrown at dom/blocks/boundary.js:237 when a <svelte:boundary> reset() function is invoked while the boundary's onerror handler is still executing (calling_on_error is true). Resetting synchronously during error handling would re-enter rendering before the error is fully processed, so Svelte requires reset to be deferred (e.g. called from a user action or after onerror returns).","triggerScenarios":"Calling the reset callback passed to onerror synchronously inside the onerror function body. The guard at boundary.js:236-238 checks calling_on_error.","commonSituations":"Attempting immediate recovery by calling reset() at the end of onerror; retry-on-error logic that calls reset without user interaction; resetting from within the same error-handling tick.","solutions":["Do not call reset() synchronously inside onerror — return first and let the user trigger reset (e.g. via a button in the failed UI).","Defer the reset with queueMicrotask or setTimeout if automatic recovery is required.","If you need automatic retry, set a flag in onerror and trigger reset from a $effect or event."],"exampleFix":"// before\n<svelte:boundary>\n  {#snippet failed(error, reset)}\n    <button onclick={() => reset()}>Retry</button>\n  {/snippet}\n</svelte:boundary>\n<script>\n  // somewhere: onerror(error, reset) { reset(); } // throws\n</script>\n\n// after — let the user trigger reset\n{#snippet failed(error, reset)}\n  <button onclick={reset}>Retry</button>\n{/snippet}","handlingStrategy":"validation","validationCode":"// Do not call reset() synchronously inside onerror.\n// Surface a retry control in the failed UI instead:\n// {#snippet failed(error, reset)}\n//   <button onclick={reset}>Retry</button>\n// {/snippet}\n// For automatic retry, defer: queueMicrotask(() => reset());","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat reset() as a user-triggered action, not an automatic recovery inside onerror.","Render a retry button in the failed snippet that calls reset on click.","If automatic retry is required, defer the reset with queueMicrotask or setTimeout."],"tags":["svelte","error-boundary","runes","rendering"],"backgroundTag":null,"analyzedSha":"20b341f10048cf1016a2028ac7eee5595cfef6a5","analyzedAt":"2026-08-12T23:37:30.399Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}