Nuxt · NUXT0020

Call Nuxt composables before await

Flags composable after await in Nuxt context code before it leaks into runtime behavior.
NUXT0020vite-doctor/nuxtcontexterrorSuggestion

Run this rule

pnpm nuxt doctor --rules nuxt/context/no-composable-after-await

Why it matters

Nuxt gives this pattern a specific contract. Staying inside that contract makes the code easier to test, refactor, and run across server and client runtimes.

Remove composable after await, or move it to the Nuxt runtime/API that owns that behavior.

Example

Call composables before await

Before

export default defineNuxtPlugin(async () => {
  await preloadConfig()
  const route = useRoute()
})

After

export default defineNuxtPlugin(async () => {
  const route = useRoute()
  await preloadConfig()
})
Copyright © 2026