vuejs/vue-router · error
Route with name '${name}' does not exist
Error message
Route with name '${name}' does not exist What it means
Development-mode warning emitted by the router's matcher when router.push/router.replace (or a <router-link :to>) resolves a location by name, but no route record registered under that name in the route map (nameMap). It fires because the named route was never declared, was renamed, is registered on a nested child only reachable under a different name, or the routes array was not registered before navigation. Since no record exists, the matcher falls back to _createRoute(null, location), which typically yields an empty/no-match route instead of the intended component.
Source
Thrown at src/create-matcher.js:62
}
}
function getRoutes () {
return pathList.map(path => pathMap[path])
}
function match (
raw: RawLocation,
currentRoute?: Route,
redirectedFrom?: Location
): Route {
const location = normalizeLocation(raw, currentRoute, false, router)
const { name } = location
if (name) {
const record = nameMap[name]
if (process.env.NODE_ENV !== 'production') {
warn(record, `Route with name '${name}' does not exist`)
}
if (!record) return _createRoute(null, location)
const paramNames = record.regex.keys
.filter(key => !key.optional)
.map(key => key.name)
if (typeof location.params !== 'object') {
location.params = {}
}
if (currentRoute && typeof currentRoute.params === 'object') {
for (const key in currentRoute.params) {
if (!(key in location.params) && paramNames.indexOf(key) > -1) {
location.params[key] = currentRoute.params[key]
}
}
}
View on GitHub (pinned to 680ccc68c5)
Solutions
- Check the routes array passed to new Router({ routes }) and ensure a route with the exact `name` string exists
- Fix typos or casing mismatches between the navigation target name and the route's declared name
- If the target is a nested child, reference its own `name` property, not the parent's
- Ensure the routes are registered before the navigation happens (e.g., router.addRoutes for dynamically added routes)
- Use a path-based location ({ path: '/target' }) instead of a name when the route is intentionally unnamed
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/create-matcher.js:62 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of vuejs/vue-router@680ccc68c5 (2026-09-02).
Data as JSON: /api/errors/f7f5e5abd200c38e.
Report an issue: GitHub.