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
- Change `kit.router.type` from 'hash' to 'pathname' (or 'hash' only if resolution stays client-side).
- Or change `kit.router.resolution` to 'client' to keep hash routing.
- 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
- Treat router.type and router.resolution as a pair when editing config
- Prefer the default pathname routing unless a specific constraint requires hash
- Review merged/partial configs for clashing router options
- Consult the router docs before changing either option
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
- The `router.resolution` option cannot be 'server' if `output
- The _headers file should be placed in the project root rathe
- The _redirects file should be placed in the project root rat
- routes.include must contain 100 or fewer routes
- The _headers file should be placed in the project root rathe
AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02).
Data as JSON: /api/errors/4f3878ae3fc6a014.
Report an issue: GitHub.