XML error reference · XV028

Nesting depth limit exceeded

The document nests deeper than the configured limit, which can exhaust the parser stack.

What your parser calls it

The same problem, reported differently by each parser. If you arrived here from one of these strings, you are in the right place.

ParserMessage
libxml2 / xmllintExcessive depth in document: 256, use XML_PARSE_HUGE option

What causes it

Recursive-descent parsers consume stack proportional to nesting depth, so a document nested tens of thousands of levels deep can crash a parser or exhaust memory even though the file itself is small. This is a recognised denial of service vector, and real documents essentially never nest beyond a few dozen levels.

See it happen

Triggers the error
<a><a><a><!-- 100000 levels --></a></a></a>
Corrected
<items>
  <item/>
  <item/>
</items>

How to fix it

If this is real data, the structure is almost certainly not what you intended. Look for a serialiser that is nesting rather than appending. If you are testing parser hardening, this is exactly the behaviour you want: a bounded, reported failure rather than a crash.

Fix your own document

Paste your own document below. Press Sample if you want the broken example above loaded instead. Nothing you paste leaves this tab.

XML Validator

Well-formedness and schema validation. Nothing is uploaded.

Input
WaitingPaste a document to check it. Validation runs as you type.

Everything runs in this tab. Nothing you paste is uploaded, logged or sent anywhere. Open your network panel and check.

Tools that catch this

Background reading

Errors this fixes

Every XML error, explained