run-llama/llama_index · error · ValueError
There is no root nodes in given nodes!
Error message
There is no root nodes in given nodes!
What it means
Error "There is no root nodes in given nodes!" thrown in run-llama/llama_index.
Source
Thrown at llama-index-core/llama_index/core/node_parser/relational/hierarchical.py:67
children_ids.extend([r.node_id for r in (node.child_nodes or [])])
child_nodes = []
for candidate_node in all_nodes:
if candidate_node.node_id not in children_ids:
continue
child_nodes.append(candidate_node)
return child_nodes
def get_deeper_nodes(nodes: List[BaseNode], depth: int = 1) -> List[BaseNode]:
"""Get children of root nodes in given nodes that have given depth."""
if depth < 0:
raise ValueError("Depth cannot be a negative number!")
root_nodes = get_root_nodes(nodes)
if not root_nodes:
raise ValueError("There is no root nodes in given nodes!")
deeper_nodes = root_nodes
for _ in range(depth):
deeper_nodes = get_child_nodes(deeper_nodes, nodes)
return deeper_nodes
class HierarchicalNodeParser(NodeParser):
"""
Hierarchical node parser.
Splits a document into a recursive hierarchy Nodes using a NodeParser.
NOTE: this will return a hierarchy of nodes in a flat list, where there will be
overlap between parent nodes (e.g. with a bigger chunk size), and child nodes
per parent (e.g. with a smaller chunk size).
View on GitHub (pinned to afd0fef371)
Solutions
- Include at least one root-level node in the input nodes.
- Verify the nodes were produced by the hierarchical parser and contain root nodes.
When it happens
Trigger: Thrown at llama-index-core/llama_index/core/node_parser/relational/hierarchical.py:67 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of run-llama/llama_index@afd0fef371 (2026-08-15).
Data as JSON: /api/errors/24294fc19a9c2a99.
Report an issue: GitHub.