{"record":{"id":"946cc21a20e91cb9","repo":"run-llama/llama_index","slug":"child-objects-must-be-a-list-of-relatednodeinfo-ob","errorCode":null,"errorMessage":"Child objects must be a list of RelatedNodeInfo objects.","messagePattern":"Child objects must be a list of RelatedNodeInfo objects\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/schema.py","lineNumber":447,"sourceCode":"    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:\n            return None\n        return source_node.node_id\n\n    @property\n    @deprecated(\n        version=\"0.12.2\",\n        reason=\"'extra_info' is deprecated, use 'metadata' instead.\",\n    )\n    def extra_info(self) -> dict[str, Any]:  # pragma: no coverde\n        return self.metadata\n","sourceCodeStart":429,"sourceCodeEnd":465,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/schema.py#L429-L465","documentation":"TextNode.child_nodes reads relationships[NodeRelationship.CHILD] and, opposite to the singular relations, requires a list of RelatedNodeInfo. CHILD is the only plural relationship in the schema; a single RelatedNodeInfo or dict raises ValueError.","triggerScenarios":"Setting relationships[NodeRelationship.CHILD] = RelatedNodeInfo(...) (single object) or a dict, then reading .child_nodes.","commonSituations":"Builders that treat CHILD like PREVIOUS/NEXT/PARENT and store one object; JSON round-trips that collapse a one-element list into a bare object.","solutions":["Always store CHILD as a list, even with one element: [RelatedNodeInfo(...)]","Guard JSON ingestion: if the parsed CHILD is not a list, wrap it in one","Use core node parsers to generate child links"],"exampleFix":"# before\nnode.relationships[NodeRelationship.CHILD] = RelatedNodeInfo(node_id=child_id)\n\n# after\nnode.relationships[NodeRelationship.CHILD] = [RelatedNodeInfo(node_id=child_id)]","handlingStrategy":"validation","validationCode":"rel = node.relationships.get(NodeRelationship.CHILD)\nif rel is not None and not isinstance(rel, list):\n    node.relationships[NodeRelationship.CHILD] = [rel if isinstance(rel, RelatedNodeInfo) else RelatedNodeInfo.model_validate(rel)]","typeGuard":"def has_valid_children(node) -> bool:\n    rel = node.relationships.get(NodeRelationship.CHILD)\n    return rel is None or (isinstance(rel, list) and all(isinstance(r, RelatedNodeInfo) for r in rel))","tryCatchPattern":null,"preventionTips":["Always wrap CHILD values in a list, including single children","Watch for JSON round-trips collapsing one-element lists","Unit-test relationship shapes for custom builders"],"tags":["schema","nodes","relationships","hierarchy"],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}