run-llama/llama_index · error · Error

Aborting parsing document; {numTags} elements found

Error message

Aborting parsing document; {numTags} elements found

What it means

Raised by BaseDocumentStore.aget_node (async) when the node_id is absent AND the underlying aget_document call failed to raise despite raise_error=True. The comment in the source states the docstore 'should have raised an error if the node_id is not found, but it didn't', so this is a defensive backstop: either the node genuinely does not exist, or the concrete store's aget_document violates the contract by returning None with raise_error=True.

Source

Thrown at llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/readability_web/Readability.js:2558

  /**
   * Runs readability.
   *
   * Workflow:
   *  1. Prep the document by removing script tags, css, etc.
   *  2. Build readability's DOM tree.
   *  3. Grab the article content from the current dom tree.
   *  4. Replace the current DOM tree with the new one.
   *  5. Read peacefully.
   *
   * @return void
   **/
  parse: function () {
    // Avoid parsing too large documents, as per configuration option
    if (this._maxElemsToParse > 0) {
      var numTags = this._doc.getElementsByTagName("*").length;
      if (numTags > this._maxElemsToParse) {
        throw new Error(
          "Aborting parsing document; " + numTags + " elements found",
        );
      }
    }

    // Unwrap image from noscript
    this._unwrapNoscriptImages(this._doc);

    // Extract JSON-LD metadata before removing scripts
    var jsonLd = this._disableJSONLD ? {} : this._getJSONLD(this._doc);

    // Remove script tags from the document.
    this._removeScripts(this._doc);

    this._prepDocument();

    var metadata = this._getArticleMetadata(jsonLd);
    this._articleTitle = metadata.title;

View on GitHub (pinned to afd0fef371)

Solutions

  1. Verify the node exists first: (await docstore.aget_document(node_id, raise_error=False)) is not None.
  2. Ensure the full storage context (docstore.json plus index store) is persisted and reloaded together, so node ids in index_struct resolve.
  3. Re-run ingestion so nodes referenced by the index exist in the docstore.
  4. If implementing a custom DocumentStore, make aget_document raise when raise_error=True and the id is missing, instead of returning None.

Example fix

# before
node = await docstore.aget_node(missing_id)  # ValueError: Node ... not found

# after
node = await docstore.aget_node(missing_id, raise_error=False)
if node is None:
    # handle missing node: skip, re-index, or log
    ...
Defensive patterns

Strategy: validation

Validate before calling

doc = await docstore.aget_document(node_id, raise_error=False)
if doc is None:
    # node missing; skip, re-index, or use aget_node(raise_error=False)
    ...

Try / catch

try:
    node = await docstore.aget_node(node_id)
except ValueError as e:
    if "not found" in str(e):
        log.warning("missing node %s; skipping", node_id)
        node = None
    else:
        raise

Prevention

When it happens

Trigger: Awaiting docstore.aget_node("some_id") for an id never added or already deleted; or a custom async docstore whose aget_document(node_id, raise_error=True) returns None instead of raising, breaking the BaseDocumentStore contract.

Common situations: Querying an index whose docstore was not persisted/restored (empty store after restart); nodes evicted by a store TTL/capacity policy; mismatch between the vector store index_struct node ids and the docstore contents (e.g. reloaded only part of the storage context); custom KV-backed docstore implementations with buggy get semantics.

Related errors


AI-assisted analysis of run-llama/llama_index@afd0fef371 (2026-08-15). Data as JSON: /api/errors/b4d81deec96e4575. Report an issue: GitHub.