Vue · VUE0052
Render component roots where the HTML parser keeps them
Finds a component usage that sits directly inside an HTML element which cannot contain the component's root element, such as a component rendering `<div>` inside `<p>`, `<tr>` directly inside `<table>`, `<a>` inside `<a>`, or `<form>` inside `<form>`. Doctor uses Vue's template compiler nesting table and reports only pairs it knows the HTML parser closes, drops, or moves. It checks every branch of a root `v-if` chain, and reports only usages resolved to one SFC whose parent and root tags are plain elements, not components, slots, `<template>` wrappers, or `<component :is>`. It requires SSR evidence and skips usages known to render only in the default slot of Nuxt's `<ClientOnly>` or through Nuxt's client- and server-mode component transforms. The fallback and placeholder slots still render on the server, and a direct file import does not apply Nuxt's component mode. When tracing callers, Doctor follows a literal `is` to a prepared Nuxt global only when it can rule out a local match. If the registration is missing from Nuxt's inventory or the local options cannot be read statically, Doctor does not follow that literal and can miss a mismatch inside the target. A `.global.vue` filename alone does not establish an SSR caller.
vue/ssr/no-invalid-root-nestingsrc/rule-packs/vue/rules/vue/no-invalid-root-nesting.ts Upstream docs Run this rule
pnpm vite-doctor . --framework vue --rules vue/ssr/no-invalid-root-nesting
Why it matters
Vue's compiler warns about invalid nesting inside one template, but not when the invalid child is another component's root. During SSR, the server sends the nesting as HTML and the browser's parser rewrites it: a <div> closes the open <p>, a <tr> gets an implied <tbody>, a nested <form> is dropped. Vue then hydrates against DOM it did not render and logs "Hydration node mismatch" or "Hydration children mismatch", patching or recreating the subtree.
Recommended fix
Change the parent element to one that can contain the component's root, such as a <div> instead of a <p>, add the missing <tbody>, or change the component's root element to one that is valid in that parent.
Useful links
Example
Wrap block content in a block element
Before
<!-- Card.vue -->
<template>
<div class="card"><slot /></div>
</template>
<!-- Page.vue -->
<template>
<p><Card>Hello</Card></p>
</template>
After
<!-- Card.vue -->
<template>
<div class="card"><slot /></div>
</template>
<!-- Page.vue -->
<template>
<div><Card>Hello</Card></div>
</template>