Nuxt · Data fetching
NUXT0024Register custom keyed data composables
Finds Nuxt fetch code that can be written with a clearer framework-supported pattern.
vite-doctor/nuxtfetchingwarnSuggestion
Why it happens
Nuxt data fetching relies on stable keys, payload serialization, and request context. Bypassing those contracts can duplicate requests or lose SSR data.
Fix
Use the Nuxt-supported keyed composable registration required pattern instead.
Example
Use keyed composable registration required
Before
export const useUser = createUseFetch('/api/user')
export default defineNuxtConfig({})
After
export const useUser = createUseFetch('/api/user')
export default defineNuxtConfig({
optimization: {
keyedComposables: [
{ name: 'useUser', argumentLength: 2 },
],
},
})
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/keyed-composable-registration-required