run-llama/llama_index · error · ValueError

Document {node_id} is not a Node.

Error message

Document {node_id} is not a Node.

What it means

Error "Document {node_id} is not a Node." thrown in run-llama/llama_index.

Source

Thrown at llama-index-core/llama_index/core/storage/docstore/types.py:209

        Get node from docstore.

        Args:
            node_id (str): node id
            raise_error (bool): raise error if node_id not found

        """
        doc = self.get_document(node_id, raise_error=raise_error)

        if doc is None:
            # The doc store should have raised an error if the node_id is not found, but it didn't
            # so we raise an error here
            if raise_error:
                raise ValueError(f"Node {node_id} not found")
            return None

        # The document should always be a BaseNode, but we check to be safe
        if not isinstance(doc, BaseNode):
            raise ValueError(f"Document {node_id} is not a Node.")

        return doc

    @overload
    async def aget_node(
        self, node_id: str, raise_error: Literal[True] = True
    ) -> BaseNode: ...

    @overload
    async def aget_node(
        self, node_id: str, raise_error: Literal[False] = False
    ) -> Optional[BaseNode]: ...

    async def aget_node(
        self, node_id: str, raise_error: bool = True
    ) -> Optional[BaseNode]:
        """
        Get node from docstore.

View on GitHub (pinned to afd0fef371)

Solutions

  1. Store a Node subclass instance under this id, not a plain Document.
  2. Wrap the data in a TextNode/Node before adding it to the docstore.

When it happens

Trigger: Thrown at llama-index-core/llama_index/core/storage/docstore/types.py:209 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/8c484de104ef2086. Report an issue: GitHub.