` inside `Parent`, this warning is thrown.
+
+To fix it, `bind:` to the value instead of just passing a property (i.e. in this example do ` `).
+
## ownership_invalid_mutation
> Mutating a value outside the component that created it is strongly discouraged. Consider passing values to child components with `bind:`, or use a callback instead
> %component% mutated a value owned by %owner%. This is strongly discouraged. Consider passing values to child components with `bind:`, or use a callback instead
+Consider the following code:
+
+```svelte
+
+
+
+
+```
+
+```svelte
+
+
+
+
+
+```
+
+`Child` is mutating `person` which is owned by `App` without being explicitly "allowed" to do so. This is strongly discouraged since it can create code that is hard to reason about at scale ("who mutated this value?"), hence the warning.
+
+To fix it, either create callback props to communicate changes, or mark `person` as [`$bindable`]($bindable).
+
## reactive_declaration_non_reactive_property
> A `$:` statement (%location%) read reactive state that was not visible to the compiler. Updates to this state will not cause the statement to re-run. The behaviour of this code will change if you migrate it to runes mode
diff --git a/packages/svelte/messages/compile-warnings/script.md b/packages/svelte/messages/compile-warnings/script.md
index 2c891b4fc791..8c32fb708266 100644
--- a/packages/svelte/messages/compile-warnings/script.md
+++ b/packages/svelte/messages/compile-warnings/script.md
@@ -6,10 +6,36 @@
> Svelte 5 components are no longer classes. Instantiate them using `mount` or `hydrate` (imported from 'svelte') instead.
+See the [migration guide](v5-migration-guide#Components-are-no-longer-classes) for more info.
+
## non_reactive_update
> `%name%` is updated, but is not declared with `$state(...)`. Changing its value will not correctly trigger updates
+This warning is thrown when the compiler detects the following:
+- a variable was declared without `$state` or `$state.raw`
+- the variable is reassigned
+- the variable is read in a reactive context
+
+In this case, changing the value will not correctly trigger updates. Example:
+
+```svelte
+
+
+This value updates: {reactive}
+This value does not update: {stale}
+
+ {
+ stale = 'updated';
+ reactive = 'updated';
+}}>update
+```
+
+To fix this, wrap your variable declaration with `$state`.
+
## perf_avoid_inline_class
> Avoid 'new class' — instead, declare the class at the top level scope
@@ -30,6 +56,71 @@
> State referenced in its own scope will never update. Did you mean to reference it inside a closure?
+This warning is thrown when the compiler detects the following:
+- A reactive variable is declared
+- the variable is reassigned
+- the variable is referenced inside the same scope it is declared and it is a non-reactive context
+
+In this case, the state reassignment will not be noticed by whatever you passed it to. For example, if you pass the state to a function, that function will not notice the updates:
+
+```svelte
+
+
+
+ count++}>
+ increment
+
+```
+
+```svelte
+
+
+
+
+The count is {count}
+```
+
+To fix this, reference the variable such that it is lazily evaluated. For the above example, this can be achieved by wrapping `count` in a function:
+
+```svelte
+
+
+
+ count++}>
+ increment
+
+```
+
+```svelte
+
+
+
+
+The count is {+++count()+++}
+```
+
+For more info, see [Passing state into functions]($state#Passing-state-into-functions).
+
## store_rune_conflict
> It looks like you're using the `$%name%` rune, but there is a local binding called `%name%`. Referencing a local variable with a `$` prefix will create a store subscription. Please rename `%name%` to avoid the ambiguity
diff --git a/packages/svelte/messages/compile-warnings/style.md b/packages/svelte/messages/compile-warnings/style.md
index 6967458cf46a..780f4ae9e512 100644
--- a/packages/svelte/messages/compile-warnings/style.md
+++ b/packages/svelte/messages/compile-warnings/style.md
@@ -1,3 +1,17 @@
## css_unused_selector
> Unused CSS selector "%name%"
+
+Svelte traverses both the template and the `
+```
diff --git a/packages/svelte/messages/compile-warnings/template.md b/packages/svelte/messages/compile-warnings/template.md
index 690681c172a3..b15b01241b8c 100644
--- a/packages/svelte/messages/compile-warnings/template.md
+++ b/packages/svelte/messages/compile-warnings/template.md
@@ -38,6 +38,8 @@
> Using `on:%name%` to listen to the %name% event is deprecated. Use the event attribute `on%name%` instead
+See [the migration guide](v5-migration-guide#Event-changes) for more info.
+
## node_invalid_placement_ssr
> %message%. When rendering this component on the server, the resulting HTML will be modified by the browser (by moving, removing, or inserting elements), likely resulting in a `hydration_mismatch` warning
@@ -54,6 +56,12 @@ This code will work when the component is rendered on the client (which is why t
> `context="module"` is deprecated, use the `module` attribute instead
+```svelte
+
+```
+
## script_unknown_attribute
> Unrecognized attribute — should be one of `generics`, `lang` or `module`. If this exists for a preprocessor, ensure that the preprocessor removes it
@@ -62,6 +70,8 @@ This code will work when the component is rendered on the client (which is why t
> Using `` to render parent content is deprecated. Use `{@render ...}` tags instead
+See [the migration guide](v5-migration-guide#Snippets-instead-of-slots) for more info.
+
## svelte_component_deprecated
> `` is deprecated in runes mode — components are dynamic by default
@@ -104,3 +114,5 @@ A derived value may be used in other contexts:
## svelte_self_deprecated
> `` is deprecated — use self-imports (e.g. `import %name% from './%basename%'`) instead
+
+See [the note in the docs](legacy-svelte-self) for more info.
diff --git a/packages/svelte/messages/server-errors/lifecycle.md b/packages/svelte/messages/server-errors/lifecycle.md
index 80830f79034c..c3acdedf3d25 100644
--- a/packages/svelte/messages/server-errors/lifecycle.md
+++ b/packages/svelte/messages/server-errors/lifecycle.md
@@ -1,3 +1,5 @@
## lifecycle_function_unavailable
> `%name%(...)` is not available on the server
+
+Certain methods such as `mount` cannot be invoked while running in a server context. Avoid calling them eagerly, i.e. not during render.
diff --git a/packages/svelte/messages/shared-errors/errors.md b/packages/svelte/messages/shared-errors/errors.md
index ef030c8a1c91..8b4c61303a07 100644
--- a/packages/svelte/messages/shared-errors/errors.md
+++ b/packages/svelte/messages/shared-errors/errors.md
@@ -2,10 +2,52 @@
> Cannot use `{@render children(...)}` if the parent component uses `let:` directives. Consider using a named snippet instead
+This error would be thrown in a setup like this:
+
+```svelte
+
+
+ {entry}
+
+```
+
+```svelte
+
+
+
+
+ {#each items as item}
+ {@render children(item)}
+ {/each}
+
+```
+
+Here, `List.svelte` is using `{@render children(item)` which means it expects `Parent.svelte` to use snippets. Instead, `Parent.svelte` uses the deprecated `let:` directive. This combination of APIs is incompatible, hence the error.
+
## lifecycle_outside_component
> `%name%(...)` can only be used during component initialisation
+Certain lifecycle methods can only be used during component initialisation. To fix this, make sure you're invoking the method inside the _top level of the instance script_ of your component.
+
+```svelte
+
+
+click me
+```
+
## store_invalid_shape
> `%name%` is not a store with a `subscribe` method
diff --git a/packages/svelte/messages/shared-warnings/warnings.md b/packages/svelte/messages/shared-warnings/warnings.md
index c6cc81761ee3..c76fb10cdf8b 100644
--- a/packages/svelte/messages/shared-warnings/warnings.md
+++ b/packages/svelte/messages/shared-warnings/warnings.md
@@ -2,6 +2,8 @@
> `` is a void element — it cannot have content
+Elements such as ` ` cannot have content, any children passed to these elements will be ignored.
+
## state_snapshot_uncloneable
> Value cannot be cloned with `$state.snapshot` — the original value was returned
@@ -9,3 +11,10 @@
> The following properties cannot be cloned with `$state.snapshot` — the return value contains the originals:
>
> %properties%
+
+`$state.snapshot` tries to clone the given value in order to return a reference that no longer changes. Certain objects may not be cloneable, in which case the original value is returned. In the following example, `property` is cloned, but `window` is not, because DOM elements are uncloneable:
+
+```js
+const state = $state({ property: 'this is cloneable', window })
+const snapshot = $state.snapshot();
+```