{"record":{"id":"18bda7c77dd31149","repo":"sveltejs/kit","slug":"no-matcher-found-for-parameter-name-file","errorCode":null,"errorMessage":"No matcher found for parameter '${name}'${file ? ` in ${file}` : ''}","messagePattern":"No matcher found for parameter '(.+?)'(.+?)` : ''\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/kit/src/utils/params.js","lineNumber":30,"sourceCode":"\n\tfor (const route of routes) {\n\t\tfor (const param of route.params) {\n\t\t\tif (param.matcher) names.add(param.matcher);\n\t\t}\n\t}\n\n\treturn names;\n}\n\n/**\n * @param {Record<string, unknown>} params\n * @param {Set<string>} names\n * @param {string} [file]\n */\nexport function validate_param_matchers(params, names, file) {\n\tfor (const name of names) {\n\t\tif (!Object.hasOwn(params, name)) {\n\t\t\tthrow new Error(`No matcher found for parameter '${name}'${file ? ` in ${file}` : ''}`);\n\t\t}\n\t}\n}\n\n/**\n * @param {{\n *   routes: import('types').RouteData[];\n *   params_path: string | null;\n *   root: string;\n *   load?: (file: string) => Promise<Record<string, unknown>>;\n * }} opts\n * @returns {Promise<Record<string, ParamMatcher> | null>}\n */\nexport async function load_and_validate_params({ routes, params_path, root, load }) {\n\tconst names = collect_matcher_names(routes);\n\n\tif (names.size === 0) return null;\n","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/utils/params.js#L12-L48","documentation":"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.","triggerScenarios":"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`.","commonSituations":"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.","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"],"exampleFix":"// before (defineParams)\nexport const params = defineParams({ integer: v.integer() });\n// route: src/routes/[n=integer]/+page.svelte, but matcher named 'num' elsewhere\n// after\nexport const params = defineParams({\n\tnum: v.integer()\n}); // or rename the route to [n=integer]","handlingStrategy":"validation","validationCode":"const names = ['integer', 'slug']; // collected from route ids\nfor (const name of names) {\n\tif (!(name in exportedParams)) {\n\t\tthrow new Error(`Matcher '${name}' is used by a route but missing from params export`);\n\t}\n}","typeGuard":"function hasMatcher(params, name) {\n\treturn typeof params === 'object' && params !== null && Object.hasOwn(params, name);\n}","tryCatchPattern":null,"preventionTips":["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"],"tags":["routing","params","build-time","config"],"backgroundTag":"missing-param-matcher","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}