Nuxt · NUXT0103

Return a value from useAsyncData handlers

Finds a useAsyncData or useLazyAsyncData handler that never returns a value.
NUXT0103vite-doctor/nuxtfetchingwarnSuggestion

Run this rule

pnpm nuxt doctor --rules nuxt/fetch/handler-must-return

Why it matters

A handler that resolves to undefined leaves no data in the payload. During hydration, Nuxt skips the fetch if the payload contains data or an error; otherwise the handler can run again and Nuxt warns in development (NUXT_E3006). Arrow functions with an expression body count as returning, and handlers that always throw are not reported. Doctor skips client-only calls, apps with ssr: false, calls with server: false, immediate: false, enabled: false, a transform, pick, default, or getCachedData option, and options it cannot read. Side effects inside the handler are reported separately by nuxt/async-data-handler-pure (NUXT0017).

Return the data the page renders. If the handler only runs side effects, return null, or move the side effects out of useAsyncData.

Example

Return the fetched data

Before

const store = useCartStore()
await useAsyncData('cart', async () => {
  store.items = await $fetch('/api/cart')
})

After

const { data: items } = await useAsyncData('cart', () => $fetch('/api/cart'))
Copyright © 2026