Nuxt · Data fetching

NUXT0103Return a value from useAsyncData handlers

Finds a useAsyncData or useLazyAsyncData handler that never returns a value.

Why it happens

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).

Fix

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'))

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/fetch/handler-must-return
Copyright © 2026