run-llama/llama_index · error · ValueError

Unknown doc type: {doc_type}

Error message

Unknown doc type: {doc_type}

What it means

Error "Unknown doc type: {doc_type}" thrown in run-llama/llama_index.

Source

Thrown at llama-index-core/llama_index/core/storage/docstore/utils.py:46

        return legacy_json_to_doc(doc_dict)
    else:
        if doc_type == Document.get_type():
            if data_dict["class_name"] == ImageDocument.class_name():
                doc = ImageDocument.from_dict(data_dict)
            else:
                doc = Document.from_dict(data_dict)
        elif doc_type == Node.get_type():
            doc = Node.from_dict(data_dict)
        elif doc_type == TextNode.get_type():
            doc = TextNode.from_dict(data_dict)
        elif doc_type == ImageNode.get_type():
            doc = ImageNode.from_dict(data_dict)
        elif doc_type == IndexNode.get_type():
            doc = IndexNode.from_dict(data_dict)
        elif doc_type == Node.get_type():
            doc = Node.from_dict(data_dict)
        else:
            raise ValueError(f"Unknown doc type: {doc_type}")

        return doc


def legacy_json_to_doc(doc_dict: dict) -> BaseNode:
    """Todo: Deprecated legacy support for old node versions."""
    doc_type = doc_dict[TYPE_KEY]
    data_dict = doc_dict[DATA_KEY]
    doc: BaseNode

    text = data_dict.get("text", "")
    metadata = data_dict.get("extra_info", {}) or {}
    id_ = data_dict.get("doc_id", None)

    relationships = data_dict.get("relationships", {})
    relationships = {
        NodeRelationship(k): RelatedNodeInfo(node_id=str(v))
        for k, v in relationships.items()

View on GitHub (pinned to afd0fef371)

Solutions

  1. Use a known doc_type such as the one produced by the node's class_name.
  2. Register or map the custom doc type before converting docstore JSON to a node.

When it happens

Trigger: Thrown at llama-index-core/llama_index/core/storage/docstore/utils.py:46 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/7ebd5a6a08b08cd1. Report an issue: GitHub.