sveltejs/kit · error · Error
The `router.resolution` option cannot be 'server' if `output
Error message
The `router.resolution` option cannot be 'server' if `output.bundleStrategy` is 'inline' or 'single'
What it means
Server-side route resolution requires the client bundle to load per-route modules on demand, so it only works with `output.bundleStrategy: 'split'`. validate_config throws when `router.resolution` is 'server' but the bundle strategy is 'inline' or 'single', since those strategies produce a bundle that cannot perform server-driven resolution.
Source
Thrown at packages/kit/src/core/config/index.js:197
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) {
const error = /** @type {Error} */ (e);
// Print a nicer version of the error to the console
console.log(styleText(['bold', 'red'], `\n${error.message}\n`));
View on GitHub (pinned to 03f1687fe6)
Solutions
- Set `kit.output.bundleStrategy: 'split'` in svelte.config.js.
- Or set `kit.router.resolution: 'client'` to keep the inline/single bundle strategy.
- If you need a single-file bundle, reconsider whether server resolution is actually required for your deployment target.
Example fix
// before
kit: { router: { resolution: 'server' }, output: { bundleStrategy: 'single' } }
// after
kit: { router: { resolution: 'server' }, output: { bundleStrategy: 'split' } } Defensive patterns
Strategy: validation
Validate before calling
const { router = {}, output = {} } = config.kit ?? {};
if (router.resolution === 'server' && output.bundleStrategy !== 'split') {
throw new Error("router.resolution 'server' requires output.bundleStrategy 'split'");
} Try / catch
try {
await viteBuild();
} catch (e) {
if (e.message.includes("cannot be 'server' if `output.bundleStrategy`")) {
console.error("Set kit.output.bundleStrategy to 'split' or use client resolution");
}
throw e;
} Prevention
- Remember server resolution requires code-split bundles
- Use bundleStrategy 'inline'/'single' only with client resolution
- Check bundle strategy changes against router settings in code review
- Keep a validated config schema/lint rule for cross-option constraints
When it happens
Trigger: validate_config finds `validated.kit.router.resolution === 'server'` and `validated.kit.output.bundleStrategy` is 'inline' or 'single' (anything other than 'split').
Common situations: Users adopt bundleStrategy 'inline'/'single' (often for simple static deployments) while router.resolution was switched to 'server' for SEO or nested-layout resolution; config defaults from an older project template clashing with newly added options.
Related errors
- The `router.resolution` option cannot be 'server' if `router
- 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/b9ea6570465c0539.
Report an issue: GitHub.