sveltejs/kit · error

Page options are ignored when `router.type === 'hash'` (${ro

Error message

Page options are ignored when `router.type === 'hash'` (${route.id} has ${options.filter((o) => o !== 'load').map((o) => `'${o}'`).join(', ')})

What it means

When the router is configured with `router.type === 'hash'`, page-level options like `ssr`, `csr`, `prerender`, or `trailingSlash` exported from a route's universal (`+page.js`) file have no effect, because hash routing serves a single prerendered document. SvelteKit throws during client startup to surface the silent misconfiguration.

Source

Thrown at packages/kit/src/runtime/client/client.js:1168

	const uses = {
		dependencies: new Set(),
		params: new Set(),
		parent: false,
		route: false,
		url: false,
		search_params: new Set()
	};

	const node = await loader();

	if (DEV) {
		validate_page_exports(node.universal);

		if (node.universal && app.hash) {
			const options = Object.keys(node.universal).filter((o) => o !== 'load');

			if (options.length > 0) {
				throw new Error(
					`Page options are ignored when \`router.type === 'hash'\` (${route.id} has ${options
						.filter((o) => o !== 'load')
						.map((o) => `'${o}'`)
						.join(', ')})`
				);
			}
		}
	}

	if (__SVELTEKIT_HAS_UNIVERSAL_LOAD__ && node.universal?.load) {
		/** @param {string[]} deps */
		function depends(...deps) {
			for (const dep of deps) {
				if (DEV) validate_depends(/** @type {string} */ (route.id), dep);

				const { href } = new URL(dep, url);
				uses.dependencies.add(href);
			}

View on GitHub (pinned to 03f1687fe6)

Solutions

  1. Remove the page option exports (`ssr`, `csr`, `prerender`, `trailingSlash`) from universal files in the hash-routed app
  2. Set the options globally in `svelte.config.js` if they are meant app-wide
  3. Switch `router.type` back to `'pathname'` if you rely on per-route page options

Example fix

// before (+page.js, hash router)
export const prerender = true;
export const ssr = false;
export const load = async () => ({ ... });
// after
export const load = async () => ({ ... });
// (app-wide settings go in svelte.config.js)
Defensive patterns

Strategy: validation

Validate before calling

// build/dev-time check before using hash router
const disallowed = ['ssr', 'csr', 'prerender', 'trailingSlash'];
const offending = Object.keys(pageExports).filter((k) => disallowed.includes(k));
if (config.kit.router.type === 'hash' && offending.length) {
  throw new Error(`Remove page options from universal files: ${offending.join(', ')}`);
}

Type guard

const hasHashIncompatibleOptions = (universal) => Object.keys(universal ?? {}).some((o) => o !== 'load');

Try / catch

try {
  startHashRouter(routes);
} catch (e) {
  if (e.message.includes("router.type === 'hash'")) {
    console.error('Strip ssr/csr/prerender/trailingSlash exports from +page.js/+layout.js');
  } else throw e;
}

Prevention

When it happens

Trigger: Using hash routing in `svelte.config.js` while any `+page.js`/`+layout.js` (universal) exports one or more of `ssr`, `csr`, `prerender`, `trailingSlash` (anything besides `load`).

Common situations: Migrating an existing app to hash routing without auditing page options; copy-pasted `export const prerender = true` in a hash-routed project.

Related errors


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