NUXT_E8009
E8009
When a route is streamed, the response has already started being written to the browser by the time a page error is thrown. Nuxt cannot switch to a fresh error response at that point, so it finishes the stream in a state the client can recover from: it sets payload.error, flushes the payload script and the remaining head tags, and closes the document so the browser renders error.vue during hydration.
This diagnostic is reported when that recovery itself fails: the head tags registered after the shell, or the closing tags, could not be rendered. The browser then receives a blank or partially rendered page rather than your error page.
Resolution
Fix the original page error first. The recovery path only runs because rendering threw, so the diagnostic disappears once the page renders.
If the underlying error is expected (for example an upstream request that can fail), handle it in the page rather than letting it reach the renderer, so a proper error response can be sent before the stream is committed:
<script setup lang="ts">
const { data, error } = await useFetch('/api/content')
if (error.value) {
throw createError({ statusCode: 404, statusMessage: 'Not found', fatal: true })
}
</script>You can also opt the route out of streaming, so an error is rendered as a normal error response instead of being recovered mid-stream:
export default defineNuxtConfig({
routeRules: {
'/blog/**': { streaming: false },
},
})If the page error is fixed and this is still reported, the failure is inside head rendering itself. Check any useHead tag getter that reads state which may not exist while the app is in an error state, and please report it with the cause shown in the diagnostic.