Diagnostics

INVALID_HTML_NESTING

A hydrating insert claimed an element the HTML parser moved out of its parent (invalid nesting across a component boundary: <div> in <p>, <a> in <a>, <tr> in <table>) (dev; client).


What you saw

  • Kind: render
  • Severity: warn (code that works but is structurally wrong or expensive)

The console report opens with [INVALID_HTML_NESTING] and the message, then an in line naming the owners that enclose the subject, root first, and an at line with the source location when the code was compiled with one. In a captured artifact the same finding is an event with code: "INVALID_HTML_NESTING", ownerPath, and loc. Diagnostics explains each line.


Why it fires

Hydration claimed a server-rendered element that is not where the template put it: the nesting is invalid HTML, so the browser's parser rebuilt the tree. A <div> closes an open <p>, an <a> closes an open <a>, a <tr> directly in a <table> gets a <tbody> the parser adds. The compiler rejects this inside one template, so it nearly always spans a component boundary (<P>{props.children}</P> given a <div>, a <For> of row components inside <table>). The page differs from a client render and the insert cannot update the moved node. Warned once per parent, in dev only; the message names the parent, the child and where the parser put it.

Server rendering

The server runtime reports on the same channel, with the same in <App> › <Page> line. Two groups. Findings (SSR_RENDER_ERROR_CONTAINED, SSR_SUBTREE_ABANDONED, SSR_STREAM_ABANDONED, LATE_HEADER_WRITE, DYNAMIC_ASYNC_COMPONENT, ASYNC_MEMO_ELEMENT, SERVER_ERROR_SANITIZED, FRAME_MARKER_CORRUPTED) are facts about a render that exist in observe builds too — an APM sees them in production; in dev they print. Checks (the rest, SSR_BOUNDARY_WATERFALL and SSR_CLIENT_CONTENT_MASKED included) are dev-only guidance. A captured artifact from a server render carries both.


How to fix it

Fix: change the outer element (a <div> for a <p> that holds blocks, a <span> for an <a> that holds a link), move the inner element out, or write the wrapper the parser expects — <table><tbody><For …>{r => <Row />}</For></tbody></table>. A <form> inside a <form> is dropped by the parser instead; the hydration key miss names it.


In tests

captureArtifact from @solidjs/diagnostics runs a scenario with the diagnostics channel open and returns the events it saw. expectNoDiagnostics(artifact) fails while INVALID_HTML_NESTING is among them, with the events as evidence; after the fix, the code is gone from artifact.diagnostics. Check for regressions in tests shows the loop and the Vitest matcher form.


Learn more

Last updated: 11/16/26, 7:06 AMEdit this pageReport an issue with this page