sveltejs/kit · error · Error

Missing params for dynamic route ID ${id}

Error message

Missing params for dynamic route ID ${id}

What it means

Runtime guard in the resolve() helper of $app/paths: the caller passed a route ID (leading '/') containing a dynamic parameter bracket but no params object, so the dynamic segments cannot be filled in. Fires at runtime when calling resolve/asset with a parameterized route id like '/blog/[slug]' without supplying { slug: ... }.

Source

Thrown at packages/kit/src/runtime/app/paths/server.js:33

	if (file[0] === '/') {
		if (DEV) {
			console.warn(`\`asset('${file}')\` should now be \`asset('${file.slice(1)}')\``);
		}

		file = file.slice(1);
	}

	return assets !== base ? `${assets}/${file}` : resolve(file);
}

/** @type {typeof import('./client.js').resolve} */
export function resolve(id, params) {
	let resolved;

	if (id[0] === '/') {
		// route ID
		if (id.includes('[') && !params) {
			throw new Error(`Missing params for dynamic route ID ${id}`);
		}

		resolved = resolve_route(id, params ?? {});
	} else {
		resolved = '/' + id;
	}

	if (relative) {
		const store = try_get_request_store();

		if (store && !store.state.prerendering?.fallback) {
			// the relative path depth must reflect the URL the browser is actually at, which
			// for a data request includes the `__data.json` suffix that was stripped during routing
			const pathname = store.event.isDataRequest
				? add_data_suffix(store.event.url.pathname)
				: store.event.url.pathname;
			const after_base = pathname.slice(base.length);
			const segments = after_base.split('/').slice(2);

View on GitHub (pinned to 03f1687fe6)

Solutions

  1. Pass a params object as the second argument, e.g. resolve('/blog/[slug]', { slug })
  2. Use a static route id without parameter brackets if no params are needed
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/kit/src/runtime/app/paths/server.js:33 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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