Nuxt · Context

NUXT0020Call Nuxt composables before await

Flags composable after await in Nuxt context code before it leaks into runtime behavior.

Why it happens

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.

Fix

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()
})

Verify the fix

Run only this rule after editing so the report stays focused on the diagnostic you are closing:

pnpm nuxt doctor --rules nuxt/context/no-composable-after-await
Copyright © 2026