sveltejs/kit · error
`$app/stores` has been removed in favour of `$app/state`. Se
Error message
`$app/stores` has been removed in favour of `$app/state`. See https://svelte.dev/docs/kit/migrating-to-sveltekit-2#SvelteKit-2.12:-$app-stores-deprecated
What it means
The deprecated `$app/stores` module now unconditionally throws: every export (`getStores`, `navigating`, `page`, `updated`) calls `removed()`. SvelteKit removed the legacy stores in favor of the Svelte-5-native `$app/state`. Migrate your imports.
Source
Thrown at packages/kit/src/runtime/app/stores.js:5
// TODO: remove this file when enough people have migrated to Kit 3
/** @returns {never} */
function removed() {
throw new Error(
'`$app/stores` has been removed in favour of `$app/state`. See https://svelte.dev/docs/kit/migrating-to-sveltekit-2#SvelteKit-2.12:-$app-stores-deprecated'
);
}
/**
* @deprecated Use `$app/state` instead (requires Svelte 5, [see docs for more info](https://svelte.dev/docs/kit/migrating-to-sveltekit-2#SvelteKit-2.12:-$app-stores-deprecated))
*/
export const getStores = removed;
/**
* @deprecated Use `page` from `$app/state` instead (requires Svelte 5, [see docs for more info](https://svelte.dev/docs/kit/migrating-to-sveltekit-2#SvelteKit-2.12:-$app-stores-deprecated))
* @type {import('svelte/store').Readable<import('$app/state').Page>}
*/
export const page = {
subscribe: removed
};
/**View on GitHub (pinned to 03f1687fe6)
Solutions
- Replace `import { page } from '$app/stores'` with `import { page } from '$app/state'` (requires Svelte 5) and drop `$`-prefix subscription syntax
- Update or replace outdated dependencies that import `$app/stores`
- Follow the migration guide at svelte.dev/docs/kit/migrating-to-sveltekit-2#SvelteKit-2.12:-$app-stores-deprecated
Example fix
// before
import { page } from '$app/stores';
$: id = $page.params.id;
// after
import { page } from '$app/state';
const id = $derived(page.params.id); Defensive patterns
Strategy: fallback
Validate before calling
// Detect the removed import before use (build-time preferable):
if (typeof page === 'undefined' || typeof page.subscribe !== 'function' && typeof page !== 'object') {
console.warn('$app/stores is removed; migrate to $app/state');
} Type guard
const storesRemoved = (mod) => mod && typeof mod.getStores === 'function'; // presence of legacy exports signals dead code path
Try / catch
try {
const { page } = await import('$app/stores');
} catch (e) {
if (e.message.includes('$app/state')) {
const { page } = await import('$app/state');
} else throw e;
} Prevention
- Search the codebase for `$app/stores` imports during upgrades and replace with `$app/state`
- Pin/audit dependencies that still reference `$app/stores`
- Adopt Svelte 5 runes (`$derived`, `$effect`) so `$app/state` works idiomatically
When it happens
Trigger: Any import of, or property access on, `$app/stores` in application code after the removal (Kit 3-era code); stale dependencies still importing `$app/stores`.
Common situations: Upgrading SvelteKit past the deprecation window without migrating; old tutorial/example code; a library dependency that still uses `$app/stores`.
Related errors
- You must remove all `site` keys in ${config_path}. Consult h
- SvelteKit configuration (${keys}) no longer lives inside a `
- ${file} is no longer used. Please pass configuration via the
- The `goto(..., { noScroll: true, keepFocus: true })` options
- config.package is no longer supported. See https://github.co
AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02).
Data as JSON: /api/errors/5453e83f47b1afa5.
Report an issue: GitHub.