{"record":{"id":"f488e875fc12243e","repo":"vuejs/vue-router","slug":"found-an-alias-with-the-same-value-as-the-path","errorCode":null,"errorMessage":"Found an alias with the same value as the path: \"${path}\". You have to remove that alias. It will be ignored in development.","messagePattern":"Found an alias with the same value as the path: \"(.+?)\"\\. You have to remove that alias\\. It will be ignored in development\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/create-route-map.js","lineNumber":157,"sourceCode":"    route.children.forEach(child => {\n      const childMatchAs = matchAs\n        ? cleanPath(`${matchAs}/${child.path}`)\n        : undefined\n      addRouteRecord(pathList, pathMap, nameMap, child, record, childMatchAs)\n    })\n  }\n\n  if (!pathMap[record.path]) {\n    pathList.push(record.path)\n    pathMap[record.path] = record\n  }\n\n  if (route.alias !== undefined) {\n    const aliases = Array.isArray(route.alias) ? route.alias : [route.alias]\n    for (let i = 0; i < aliases.length; ++i) {\n      const alias = aliases[i]\n      if (process.env.NODE_ENV !== 'production' && alias === path) {\n        warn(\n          false,\n          `Found an alias with the same value as the path: \"${path}\". You have to remove that alias. It will be ignored in development.`\n        )\n        // skip in dev to make it work\n        continue\n      }\n\n      const aliasRoute = {\n        path: alias,\n        children: route.children\n      }\n      addRouteRecord(\n        pathList,\n        pathMap,\n        nameMap,\n        aliasRoute,\n        parent,\n        record.path || '/' // matchAs","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/vuejs/vue-router/blob/680ccc68c506cca9be6207745043245d61fa715a/src/create-route-map.js#L139-L175","documentation":"Development-mode warning raised while building the route record map: a route declares an `alias` that is identical to its own `path`. Alias records are stored in the same pathMap as real paths, so an alias equal to the path would collide with the canonical record and silently shadow or duplicate it; the alias is therefore ignored. It fires for a route config like { path: '/a', alias: '/a' } (including per-item equality when `alias` is an array).","triggerScenarios":"{ path: '/a', alias: '/a' } or an aliases array containing the route's own path, e.g. alias: ['/a', '/b'] on the route with path '/a'.","commonSituations":"Programmatic route generation where alias lists are computed and accidentally include the canonical path; copy-paste of paths between path and alias fields.","solutions":["Remove the alias entry equal to the path","Filter aliases before registration: aliases.filter(a => a !== route.path)","If the intent was a second URL, use a distinct alias path","Check generated route tables for path/alias collisions"],"exampleFix":"// before\n{ path: '/a', component: A, alias: ['/a', '/a2'] }\n// after\n{ path: '/a', component: A, alias: '/a2' }","handlingStrategy":"validation","validationCode":"function sanitizeAliases(route) {\n  if (route.alias === undefined) return route\n  const aliases = (Array.isArray(route.alias) ? route.alias : [route.alias]).filter(a => a !== route.path)\n  return { ...route, alias: aliases }\n}","typeGuard":"function aliasEqualsPath(route) {\n  const aliases = Array.isArray(route.alias) ? route.alias : [route.alias]\n  return aliases.some(a => a === route.path)\n}","tryCatchPattern":null,"preventionTips":["Filter generated alias lists against the canonical path","Never copy the path value into the alias field","Alias paths must be distinct from the route's own path"],"tags":["vue-router","routing","alias","configuration"],"backgroundTag":"duplicate-route-alias","analyzedSha":"680ccc68c506cca9be6207745043245d61fa715a","analyzedAt":"2026-09-02T19:19:01.204Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}