{"record":{"id":"6eadae284f71280a","repo":"vuejs/vue-router","slug":"missing-param-for-routemsg-e-message","errorCode":null,"errorMessage":"missing param for ${routeMsg}: ${e.message}","messagePattern":"missing param for (.+?): (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/util/params.js","lineNumber":30,"sourceCode":"  path: string,\n  params: ?Object,\n  routeMsg: string\n): string {\n  params = params || {}\n  try {\n    const filler =\n      regexpCompileCache[path] ||\n      (regexpCompileCache[path] = Regexp.compile(path))\n\n    // Fix #2505 resolving asterisk routes { name: 'not-found', params: { pathMatch: '/not-found' }}\n    // and fix #3106 so that you can work with location descriptor object having params.pathMatch equal to empty string\n    if (typeof params.pathMatch === 'string') params[0] = params.pathMatch\n\n    return filler(params, { pretty: true })\n  } catch (e) {\n    if (process.env.NODE_ENV !== 'production') {\n      // Fix #3072 no warn if `pathMatch` is string\n      warn(typeof params.pathMatch === 'string', `missing param for ${routeMsg}: ${e.message}`)\n    }\n    return ''\n  } finally {\n    // delete the 0 if it was added\n    delete params[0]\n  }\n}\n","sourceCodeStart":12,"sourceCodeEnd":38,"githubUrl":"https://github.com/vuejs/vue-router/blob/680ccc68c506cca9be6207745043245d61fa715a/src/util/params.js#L12-L38","documentation":"fillParams interpolates route params into a path-to-regexp compiled path. When a required named param in the route's path pattern (e.g. /user/:id) is missing from the params object, the underlying path-to-regexp filler throws, and this warning reports the missing param along with routeMsg identifying which path/route failed. The function catches the error and returns an empty string, so the resulting path will be incomplete.","triggerScenarios":"Calling router.push({ name: 'user', params: { } }) or omitting a required param when the named route's path contains :param segments — e.g. route path '/user/:id' resolved without params.id. Also triggered when resolving a path string via resolvePath/fillParams with an incomplete params object.","commonSituations":"Renaming a param in the route config (path changed from /user/:userId to /user/:id) but not updating all push calls; building URLs dynamically where a param can be undefined/null; typos in param keys (id vs ID); navigation to a parametrized route from data that is not yet loaded.","solutions":["Supply all required params in the location object: router.push({ name: 'user', params: { id: 1 } }).","Check route record path definitions and match param keys exactly (case-sensitive) with what you pass.","Make params optional in the route pattern with repeated/optional segments (path: '/user/:id?') only when truly optional — note a warning is still emitted unless handled.","Validate params object before navigation (all keys present and non-null), or fall back to a default route if data is missing."],"exampleFix":"// before\nrouter.push({ name: 'user', params: { userId: 1 } }) // route path is /user/:id\n// after\nrouter.push({ name: 'user', params: { id: 1 } })","handlingStrategy":"validation","validationCode":"function hasRequiredParams (routePath, params) {\n  const required = (routePath.match(/:[^/?]+/g) || []).map(s => s.slice(1).replace(/\\(.*\\)$/, ''))\n  return required.every(k => params && params[k] !== undefined && params[k] !== null && params[k] !== '')\n}\n// before navigating to a named route:\n// if (!hasRequiredParams('/user/:id', { id })) return fallback()","typeGuard":"function isCompleteParams (routePath) {\n  const required = (routePath.match(/:[^/?]+/g) || []).map(s => s.slice(1))\n  return (p) => required.every(k => typeof p?.[k] === 'string' || typeof p?.[k] === 'number')\n}","tryCatchPattern":"try {\n  router.push({ name: 'user', params: { id } })\n} catch (e) {\n  console.error('navigation failed:', e.message)\n  router.push({ name: 'not-found' })\n}","preventionTips":["Keep param keys in push calls in sync with route path definitions (extract names to constants).","Never pass possibly-undefined values as params without a guard or default.","Use TypeScript route param typings or generate push calls from route definitions.","Log/validate params objects in navigation wrappers before calling router.push."],"tags":["vue-router","params","path-params","navigation"],"backgroundTag":"missing-route-param","analyzedSha":"680ccc68c506cca9be6207745043245d61fa715a","analyzedAt":"2026-09-02T19:19:01.204Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}