Internal Svelte error with unclear reproduction steps.
The issue involves an internal Svelte error ('Batch has scheduled roots') triggered when using a derived value in an {#each} loop. The maintainer has requested a reproducible example, which is currently missing. The error suggests a flaw in Svelte's internal assumptions, but without a clear reproduction, it's difficult to diagnose or fix.
Hello, after upgrading to the latest version I get this error message when I try to render an {#each} loop where the array comes from a derived.by.
I was able to create a minimal reproduction by stripping down my project step by step.
The resulting repository can be found here: https://github.com/JoBurgard/svelte-repro-batch-has-scheduled-roots/
Uncaught Svelte error: invariant_violation
An invariant violation occurred, meaning Svelte's internal assumptions were flawed. This is a bug in Svelte, not your app — please open an issue at https://github.com/sveltejs/svelte, citing the following message: "Batch has scheduled roots"
https://svelte.dev/e/invariant_violation
in <unknown>
in undefined
in undefined
invariant_violation http://localhost:3000/public/dist/bundle/extractor-view.js:129
invariant http://localhost:3000/public/dist/bundle/extractor-view.js:677
#commit http://localhost:3000/public/dist/bundle/extractor-view.js:1160
#process http://localhost:3000/public/dist/bundle/extractor-view.js:1053
flush http://localhost:3000/public/dist/bundle/extractor-view.js:1118
ensure http://localhost:3000/public/dist/bundle/extractor-view.js:1225
run_all http://localhost:3000/public/dist/bundle/extractor-view.js:59
run_micro_tasks http://localhost:3000/public/dist/bundle/extractor-view.js:787
flush_tasks http://localhost:3000/public/dist/bundle/extractor-view.js:801
flushSync http://localhost:3000/public/dist/bundle/extractor-view.js:1287
set value http://localhost:3000/public/dist/bundle/extractor-view.js:6414
set http://localhost:3000/public/dist/bundle/extractor-view.js:5679
set http://localhost:3000/public/dist/bundle/extractor-view.js:5905
set_attributes http://localhost:3000/public/dist/bundle/extractor-view.js:5226
attribute_effect http://localhost:3000/public/dist/bundle/extractor-view.js:5247
update_reaction http://localhost:3000/publi
Claim this issue to let others know you're working on it. You'll earn 30 points when you complete it!