vuejs/vue-router · warning
Found an alias with the same value as the path: "${path}". Y
Error message
Found an alias with the same value as the path: "${path}". You have to remove that alias. It will be ignored in development. What it means
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).
Source
Thrown at src/create-route-map.js:157
route.children.forEach(child => {
const childMatchAs = matchAs
? cleanPath(`${matchAs}/${child.path}`)
: undefined
addRouteRecord(pathList, pathMap, nameMap, child, record, childMatchAs)
})
}
if (!pathMap[record.path]) {
pathList.push(record.path)
pathMap[record.path] = record
}
if (route.alias !== undefined) {
const aliases = Array.isArray(route.alias) ? route.alias : [route.alias]
for (let i = 0; i < aliases.length; ++i) {
const alias = aliases[i]
if (process.env.NODE_ENV !== 'production' && alias === path) {
warn(
false,
`Found an alias with the same value as the path: "${path}". You have to remove that alias. It will be ignored in development.`
)
// skip in dev to make it work
continue
}
const aliasRoute = {
path: alias,
children: route.children
}
addRouteRecord(
pathList,
pathMap,
nameMap,
aliasRoute,
parent,
record.path || '/' // matchAsView on GitHub (pinned to 680ccc68c5)
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
Example fix
// before
{ path: '/a', component: A, alias: ['/a', '/a2'] }
// after
{ path: '/a', component: A, alias: '/a2' } Defensive patterns
Strategy: validation
Validate before calling
function sanitizeAliases(route) {
if (route.alias === undefined) return route
const aliases = (Array.isArray(route.alias) ? route.alias : [route.alias]).filter(a => a !== route.path)
return { ...route, alias: aliases }
} Type guard
function aliasEqualsPath(route) {
const aliases = Array.isArray(route.alias) ? route.alias : [route.alias]
return aliases.some(a => a === route.path)
} Prevention
- 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
When it happens
Trigger: { 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'.
Common situations: Programmatic route generation where alias lists are computed and accidentally include the canonical path; copy-paste of paths between path and alias fields.
Related errors
- invalid redirect option: ${JSON.stringify(redirect)}
- Non-nested routes must include a leading slash character. Fi
- props in "${route.path}" is a ${typeof config}, expecting an
- Route with path "${path}" contains unencoded characters, mak
- Named Route '${route.name}' has a default child route. When
AI-assisted analysis of vuejs/vue-router@680ccc68c5 (2026-09-02).
Data as JSON: /api/errors/f488e875fc12243e.
Report an issue: GitHub.