sveltejs/kit · error · Error
No matcher found for parameter '${names.values().next().valu
Error message
No matcher found for parameter '${names.values().next().value}' What it means
When routes use param matchers, SvelteKit needs the params module that defines them. `load_and_validate_params` collects all matcher names used across routes and throws this error when the `params_path` option is absent even though at least one route needs a matcher. It reports the first missing matcher name to point the developer at the configuration gap.
Source
Thrown at packages/kit/src/utils/params.js:50
}
}
/**
* @param {{
* routes: import('types').RouteData[];
* params_path: string | null;
* root: string;
* load?: (file: string) => Promise<Record<string, unknown>>;
* }} opts
* @returns {Promise<Record<string, ParamMatcher> | null>}
*/
export async function load_and_validate_params({ routes, params_path, root, load }) {
const names = collect_matcher_names(routes);
if (names.size === 0) return null;
if (!params_path) {
throw new Error(`No matcher found for parameter '${names.values().next().value}'`);
}
const file = path.resolve(root, params_path);
const module = load ? await load(file) : await import(pathToFileURL(file).href);
if (!module.params || typeof module.params !== 'object') {
throw new Error(`${params_path} does not export \`params\` from \`defineParams\``);
}
validate_param_matchers(
/** @type {Record<string, unknown>} */ (module.params),
names,
params_path
);
return /** @type {Record<string, ParamMatcher>} */ (module.params);
}
View on GitHub (pinned to 03f1687fe6)
Solutions
- Configure `params_path` in the relevant API call (e.g. `load_and_validate_params`/manifest options) to point at the module exporting `defineParams` params
- Create the params module and export the matcher referenced by the reported parameter name
- Remove the matcher usage (e.g. `[slug]` instead of `[slug=slug]`) if matchers are not needed
Example fix
// before
const manifest = await load_and_validate_params({ routes, root, load });
// after
const manifest = await load_and_validate_params({
routes,
root,
params_path: 'src/params.js',
load
}); Defensive patterns
Strategy: validation
Validate before calling
if (routes.some((r) => /\[\w+=/.test(r.id)) && !paramsPath) {
throw new Error('Routes use matchers but params_path is not configured');
} Try / catch
try {
await load_and_validate_params(opts);
} catch (e) {
if (e.message.startsWith('No matcher found')) {
// configure params_path before retrying
}
throw e;
} Prevention
- Always set params_path in programmatic/adapter usage when routes may contain matchers
- After migrating from src/params/*.js files, verify the new single-module config is wired up
- Lint route folder names to detect `=matcher` usage early
When it happens
Trigger: `load_and_validate_params` is invoked (e.g. during manifest updates or param resolution) with `params_path` null/undefined while `collect_matcher_names(routes)` returned at least one matcher name.
Common situations: Using dynamic routes with matchers without configuring the params file path; upgrading SvelteKit where params moved from `src/params/*.js` files to a single `defineParams` module and the config was not updated; programmatic API use where `params_path` was omitted.
Related errors
- No matcher found for parameter '${name}'${file ? ` in ${file
- ${params_path} does not export `params` from `defineParams`
- Invalid param definition
- Missing params for dynamic route ID ${id}
- Invalid param: ${content}. Params and matcher names can only
AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02).
Data as JSON: /api/errors/59936cc849c32d19.
Report an issue: GitHub.