{"record":{"id":"b4d81deec96e4575","repo":"run-llama/llama_index","slug":"aborting-parsing-document-numtags-elements-foun","errorCode":null,"errorMessage":"Aborting parsing document; {numTags} elements found","messagePattern":"Aborting parsing document; (.+?) elements found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/readability_web/Readability.js","lineNumber":2558,"sourceCode":"\n  /**\n   * Runs readability.\n   *\n   * Workflow:\n   *  1. Prep the document by removing script tags, css, etc.\n   *  2. Build readability's DOM tree.\n   *  3. Grab the article content from the current dom tree.\n   *  4. Replace the current DOM tree with the new one.\n   *  5. Read peacefully.\n   *\n   * @return void\n   **/\n  parse: function () {\n    // Avoid parsing too large documents, as per configuration option\n    if (this._maxElemsToParse > 0) {\n      var numTags = this._doc.getElementsByTagName(\"*\").length;\n      if (numTags > this._maxElemsToParse) {\n        throw new Error(\n          \"Aborting parsing document; \" + numTags + \" elements found\",\n        );\n      }\n    }\n\n    // Unwrap image from noscript\n    this._unwrapNoscriptImages(this._doc);\n\n    // Extract JSON-LD metadata before removing scripts\n    var jsonLd = this._disableJSONLD ? {} : this._getJSONLD(this._doc);\n\n    // Remove script tags from the document.\n    this._removeScripts(this._doc);\n\n    this._prepDocument();\n\n    var metadata = this._getArticleMetadata(jsonLd);\n    this._articleTitle = metadata.title;","sourceCodeStart":2540,"sourceCodeEnd":2576,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/readability_web/Readability.js#L2540-L2576","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the node exists first: (await docstore.aget_document(node_id, raise_error=False)) is not None.","Ensure the full storage context (docstore.json plus index store) is persisted and reloaded together, so node ids in index_struct resolve.","Re-run ingestion so nodes referenced by the index exist in the docstore.","If implementing a custom DocumentStore, make aget_document raise when raise_error=True and the id is missing, instead of returning None."],"exampleFix":"# before\nnode = await docstore.aget_node(missing_id)  # ValueError: Node ... not found\n\n# after\nnode = await docstore.aget_node(missing_id, raise_error=False)\nif node is None:\n    # handle missing node: skip, re-index, or log\n    ...","handlingStrategy":"validation","validationCode":"doc = await docstore.aget_document(node_id, raise_error=False)\nif doc is None:\n    # node missing; skip, re-index, or use aget_node(raise_error=False)\n    ...","typeGuard":null,"tryCatchPattern":"try:\n    node = await docstore.aget_node(node_id)\nexcept ValueError as e:\n    if \"not found\" in str(e):\n        log.warning(\"missing node %s; skipping\", node_id)\n        node = None\n    else:\n        raise","preventionTips":["Persist and reload the full StorageContext (docstore + index store) together.","Verify node ids exist before dereferencing them from index_struct.","When implementing custom stores, make aget_document honor raise_error=True by raising."],"tags":["docstore","async","missing-node","llama-index"],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}