Nuxt 2 is reaching End-of-Life on June 30th, 2024.


The clearError composable clears all handled errors.

Within your pages, components, and plugins, you can use clearError to clear all errors and redirect the user.


  • options?: { redirect?: string }

You can provide an optional path to redirect to (for example, if you want to navigate to a 'safe' page).

// Without redirect

// With redirect
clearError({ redirect: '/homepage' })

Errors are set in state using useError(). The clearError composable will reset this state and calls the app:error:cleared hook with the provided options.

Read more in Docs > Getting Started > Error Handling.