{"record":{"id":"52751914fb410f4b","repo":"run-llama/llama_index","slug":"parent-object-must-be-a-single-relatednodeinfo-obj","errorCode":null,"errorMessage":"Parent object must be a single RelatedNodeInfo object","messagePattern":"Parent object must be a single RelatedNodeInfo object","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/schema.py","lineNumber":436,"sourceCode":"    def next_node(self) -> Optional[RelatedNodeInfo]:\n        \"\"\"Next node.\"\"\"\n        if NodeRelationship.NEXT not in self.relationships:\n            return None\n\n        relation = self.relationships[NodeRelationship.NEXT]\n        if not isinstance(relation, RelatedNodeInfo):\n            raise ValueError(\"Next object must be a single RelatedNodeInfo object\")\n        return relation\n\n    @property\n    def parent_node(self) -> Optional[RelatedNodeInfo]:\n        \"\"\"Parent node.\"\"\"\n        if NodeRelationship.PARENT not in self.relationships:\n            return None\n\n        relation = self.relationships[NodeRelationship.PARENT]\n        if not isinstance(relation, RelatedNodeInfo):\n            raise ValueError(\"Parent object must be a single RelatedNodeInfo object\")\n        return relation\n\n    @property\n    def child_nodes(self) -> Optional[List[RelatedNodeInfo]]:\n        \"\"\"Child nodes.\"\"\"\n        if NodeRelationship.CHILD not in self.relationships:\n            return None\n\n        relation = self.relationships[NodeRelationship.CHILD]\n        if not isinstance(relation, list):\n            raise ValueError(\"Child objects must be a list of RelatedNodeInfo objects.\")\n        return relation\n\n    @property\n    def ref_doc_id(self) -> Optional[str]:  # pragma: no cover\n        \"\"\"Deprecated: Get ref doc id.\"\"\"\n        source_node = self.source_node\n        if source_node is None:","sourceCodeStart":418,"sourceCodeEnd":454,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/schema.py#L418-L454","documentation":"TextNode.parent_node reads relationships[NodeRelationship.PARENT] and requires a single RelatedNodeInfo instance. PARENT points from a child chunk to its parent node in hierarchies (e.g. auto-merging retriever indexes), so a list or dict value is rejected.","triggerScenarios":"Assigning relationships[NodeRelationship.PARENT] a list or plain dict instead of RelatedNodeInfo, then calling .parent_node — typically in custom hierarchical ingestion or when hand-editing docstore records.","commonSituations":"Custom parent-child builders that mirror the CHILD (list) shape for PARENT; docstore records migrated or hand-edited so PARENT became a list.","solutions":["Store a single RelatedNodeInfo for PARENT","Use HierarchicalNodeParser.get_leaf_nodes/get_root_nodes workflows which set PARENT correctly","Validate the relationship type before writing nodes to storage"],"exampleFix":"# before\nnode.relationships[NodeRelationship.PARENT] = [RelatedNodeInfo(node_id=parent_id)]\n\n# after\nnode.relationships[NodeRelationship.PARENT] = RelatedNodeInfo(node_id=parent_id)","handlingStrategy":"validation","validationCode":"rel = node.relationships.get(NodeRelationship.PARENT)\nif rel is not None and not isinstance(rel, RelatedNodeInfo):\n    node.relationships[NodeRelationship.PARENT] = RelatedNodeInfo.model_validate(rel)","typeGuard":"def has_valid_parent(node) -> bool:\n    rel = node.relationships.get(NodeRelationship.PARENT)\n    return rel is None or isinstance(rel, RelatedNodeInfo)","tryCatchPattern":null,"preventionTips":["Remember PARENT is singular, CHILD is plural","Use HierarchicalNodeParser for parent/child structures","Validate hierarchy relationships before persisting"],"tags":["schema","nodes","relationships","hierarchy"],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}