Nuxt · NUXT0052

Return navigateTo in route middleware

Finds Nuxt routing code that calls navigateto in middleware without returning the result.
NUXT0052vite-doctor/nuxtroutingerrorAuto-fix

Run this rule

pnpm nuxt doctor --rules nuxt/routing/return-navigateto-in-middleware

Why it matters

Navigation helpers only work correctly in the runtime they were designed for. Returning the navigation result keeps redirects and aborts observable to Nuxt.

Return navigateTo() from route middleware so Nuxt can apply the redirect.

Example

Return navigateTo

Before

export default defineNuxtRouteMiddleware(() => {
  navigateTo('/login')
})

After

export default defineNuxtRouteMiddleware(() => {
  return navigateTo('/login')
})
Copyright © 2026