sveltejs/kit · error · Error

The `router.resolution` option cannot be 'server' if `router

Error message

The `router.resolution` option cannot be 'server' if `router.type` is 'hash'

What it means

With `router.resolution: 'server'`, route resolution happens on the server so the client router needs URL-based navigation, which is impossible with `router.type: 'hash'` (hash routing never sends the route to the server). validate_config rejects this mutually incompatible combination up front.

Source

Thrown at packages/kit/src/core/config/index.js:192

				'The SvelteKit options from the Vite config must be an object. See https://svelte.dev/docs/kit/configuration'
			);
		}

		const validated = validate_options(config, 'config');
		const files = validated.files;

		files.hooks.client ??= path.join(files.src, 'hooks.client');
		files.hooks.server ??= path.join(files.src, 'hooks.server');
		files.hooks.universal ??= path.join(files.src, 'hooks');
		files.params ??= path.join(files.src, 'params');
		files.routes ??= path.join(files.src, 'routes');
		files.serviceWorker ??= path.join(files.src, 'service-worker');
		files.appTemplate ??= path.join(files.src, 'app.html');
		files.errorTemplate ??= path.join(files.src, 'error.html');

		if (validated.router.resolution === 'server') {
			if (validated.router.type === 'hash') {
				throw new Error(
					"The `router.resolution` option cannot be 'server' if `router.type` is 'hash'"
				);
			}
			if (validated.output.bundleStrategy !== 'split') {
				throw new Error(
					"The `router.resolution` option cannot be 'server' if `output.bundleStrategy` is 'inline' or 'single'"
				);
			}
		}

		if (typeof config.adapter?.vite === 'function') {
			validated.adapter.vite = config.adapter.vite({
				config: validated
			});
		}

		return validated;
	} catch (e) {

View on GitHub (pinned to 03f1687fe6)

Solutions

  1. Change `kit.router.type` from 'hash' to 'pathname' (or 'hash' only if resolution stays client-side).
  2. Or change `kit.router.resolution` to 'client' to keep hash routing.
  3. Review svelte.config.js for shared/partial configs that combine these options from different sources.

Example fix

// before
kit: { router: { type: 'hash', resolution: 'server' } }
// after
kit: { router: { type: 'pathname', resolution: 'server' } }
Defensive patterns

Strategy: validation

Validate before calling

const { router = {} } = config.kit ?? {};
if (router.resolution === 'server' && router.type === 'hash') {
  throw new Error("router.resolution 'server' is incompatible with router.type 'hash'");
}

Try / catch

try {
  await viteBuild();
} catch (e) {
  if (e.message.includes("cannot be 'server' if `router.type` is 'hash'")) {
    console.error('Use pathname routing for server resolution, or client resolution for hash routing');
  }
  throw e;
}

Prevention

When it happens

Trigger: validate_config runs after options validation and finds `validated.kit.router.resolution === 'server'` while `validated.kit.router.type === 'hash'`.

Common situations: Users set hash routing for static hosts but later (or via defaults/updates) enable server-side resolution; merging partial configs where one option comes from a preset and the other is set manually.

Related errors


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