{"record":{"id":"59936cc849c32d19","repo":"sveltejs/kit","slug":"no-matcher-found-for-parameter-names-values-n","errorCode":null,"errorMessage":"No matcher found for parameter '${names.values().next().value}'","messagePattern":"No matcher found for parameter '(.+?)'","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/kit/src/utils/params.js","lineNumber":50,"sourceCode":"\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\n\tif (!params_path) {\n\t\tthrow new Error(`No matcher found for parameter '${names.values().next().value}'`);\n\t}\n\n\tconst file = path.resolve(root, params_path);\n\tconst module = load ? await load(file) : await import(pathToFileURL(file).href);\n\n\tif (!module.params || typeof module.params !== 'object') {\n\t\tthrow new Error(`${params_path} does not export \\`params\\` from \\`defineParams\\``);\n\t}\n\n\tvalidate_param_matchers(\n\t\t/** @type {Record<string, unknown>} */ (module.params),\n\t\tnames,\n\t\tparams_path\n\t);\n\n\treturn /** @type {Record<string, ParamMatcher>} */ (module.params);\n}\n","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/utils/params.js#L32-L68","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","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"],"exampleFix":"// before\nconst manifest = await load_and_validate_params({ routes, root, load });\n// after\nconst manifest = await load_and_validate_params({\n\troutes,\n\troot,\n\tparams_path: 'src/params.js',\n\tload\n});","handlingStrategy":"validation","validationCode":"if (routes.some((r) => /\\[\\w+=/.test(r.id)) && !paramsPath) {\n\tthrow new Error('Routes use matchers but params_path is not configured');\n}","typeGuard":null,"tryCatchPattern":"try {\n\tawait load_and_validate_params(opts);\n} catch (e) {\n\tif (e.message.startsWith('No matcher found')) {\n\t\t// configure params_path before retrying\n\t}\n\tthrow e;\n}","preventionTips":["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"],"tags":["routing","params","configuration","build-time"],"backgroundTag":"missing-param-matcher-config","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}