Nuxt · Data fetching

NUXT0026Use Nuxt data fetching primitives for SSR render data

Flags raw fetch in setup in Nuxt fetch code before it leaks into runtime behavior.

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

Remove raw fetch in setup, or move it to the Nuxt runtime/API that owns that behavior.

Example

Use Nuxt data fetching in setup

Before

<script setup lang="ts">
const data = await $fetch('/api/user')
</script>

After

<script setup lang="ts">
const { data } = await useFetch('/api/user')
</script>

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/no-raw-fetch-in-setup
Copyright © 2026