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

  1. Replace `import { page } from '$app/stores'` with `import { page } from '$app/state'` (requires Svelte 5) and drop `$`-prefix subscription syntax
  2. Update or replace outdated dependencies that import `$app/stores`
  3. 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

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


AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02). Data as JSON: /api/errors/5453e83f47b1afa5. Report an issue: GitHub.