sveltejs/kit · error · Error
No matcher found for parameter '${name}'${file ? ` in ${file
Error message
No matcher found for parameter '${name}'${file ? ` in ${file}` : ''} What it means
SvelteKit param matchers let you attach validation patterns (e.g. `integer`) to dynamic route parameters via `src/params/*.js`. When the manifest is built, every route parameter that uses a matcher must have a corresponding entry exported from the `params` file. `validate_param_matchers` throws this error when a required matcher name is not defined in the provided params object, so the build fails fast instead of producing a route that cannot resolve its parameters.
Source
Thrown at packages/kit/src/utils/params.js:30
for (const route of routes) {
for (const param of route.params) {
if (param.matcher) names.add(param.matcher);
}
}
return names;
}
/**
* @param {Record<string, unknown>} params
* @param {Set<string>} names
* @param {string} [file]
*/
export function validate_param_matchers(params, names, file) {
for (const name of names) {
if (!Object.hasOwn(params, name)) {
throw new Error(`No matcher found for parameter '${name}'${file ? ` in ${file}` : ''}`);
}
}
}
/**
* @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;
View on GitHub (pinned to 03f1687fe6)
Solutions
- Add the missing matcher key to the object exported via `defineParams` in the configured params file
- Fix the matcher name in the route id so it matches an existing key in `params`
- Re-run the build after regenerating the params file to confirm all names resolve
Example fix
// before (defineParams)
export const params = defineParams({ integer: v.integer() });
// route: src/routes/[n=integer]/+page.svelte, but matcher named 'num' elsewhere
// after
export const params = defineParams({
num: v.integer()
}); // or rename the route to [n=integer] Defensive patterns
Strategy: validation
Validate before calling
const names = ['integer', 'slug']; // collected from route ids
for (const name of names) {
if (!(name in exportedParams)) {
throw new Error(`Matcher '${name}' is used by a route but missing from params export`);
}
} Type guard
function hasMatcher(params, name) {
return typeof params === 'object' && params !== null && Object.hasOwn(params, name);
} Prevention
- Keep matcher names in route ids and defineParams keys in one shared constant list
- Grep route folders for `=matcher` usages before renaming or deleting a matcher
- Add a build-time test that loads the params module and checks all route matchers exist
When it happens
Trigger: A route id references a matcher (e.g. `/blog/[slug=friendly]`) but the module loaded from the given params file (`params_path`, typically generated by `defineParams`) has no `params` entry with the key `friendly`. Called during `load_and_validate_params` when validating collected matcher names against `module.params`.
Common situations: Renaming or deleting a matcher in `defineParams` while routes still reference the old name; typos between the route id (`[id=intiger]`) and the matcher key (`integer`); forgetting to export the matcher from the params file in a monorepo where routes were copied from another project.
Related errors
- No matcher found for parameter '${names.values().next().valu
- The _headers file should be placed in the project root rathe
- The _redirects file should be placed in the project root rat
- ${relative} does not exist
- ${relative} is missing ${tag}
AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02).
Data as JSON: /api/errors/18bda7c77dd31149.
Report an issue: GitHub.