run-llama/llama_index · error · ValueError
summary field of the index_struct not set.
Error message
summary field of the index_struct not set.
What it means
Every persisted LlamaIndex index has an IndexStruct record carrying an optional text summary used to describe the index to the LLM (and to build retriever prompts). get_summary() refuses to return None: if the index struct was saved without a summary — typical for indexes built by very old versions or constructed by hand — it raises this ValueError.
Source
Thrown at llama-index-core/llama_index/core/data_structs/data_structs.py:31
from dataclasses_json import DataClassJsonMixin
from llama_index.core.data_structs.struct_type import IndexStructType
from llama_index.core.schema import BaseNode, TextNode
# TODO: legacy backport of old Node class
Node = TextNode
@dataclass
class IndexStruct(DataClassJsonMixin):
"""A base data struct for a LlamaIndex."""
index_id: str = field(default_factory=lambda: str(uuid.uuid4()))
summary: Optional[str] = None
def get_summary(self) -> str:
"""Get text summary."""
if self.summary is None:
raise ValueError("summary field of the index_struct not set.")
return self.summary
@classmethod
@abstractmethod
def get_type(cls) -> IndexStructType:
"""Get index struct type."""
@dataclass
class IndexGraph(IndexStruct):
"""A graph representing the tree-structured index."""
# mapping from index in tree to Node doc id.
all_nodes: Dict[int, str] = field(default_factory=dict)
root_nodes: Dict[int, str] = field(default_factory=dict)
node_id_to_children_ids: Dict[str, List[str]] = field(default_factory=dict)
@propertyView on GitHub (pinned to afd0fef371)
Solutions
- Set a summary before use: index.index_struct.summary = 'summary text' (or pass summary=... when constructing the index struct)
- When loading from old storage, use load_index_from_storage(storage_context) and then assign the summary yourself before querying
- Rebuild the index from documents with VectorStoreIndex.from_documents(docs, summary='...') — modern builders fill summary automatically
Example fix
// before index = load_index_from_storage(old_storage_context) index.index_struct.get_summary() # ValueError: summary not set // after index = load_index_from_storage(old_storage_context) index.index_struct.summary = "Summary of my documents" index.index_struct.get_summary() # ok
Defensive patterns
Strategy: validation
Validate before calling
if index.index_struct.summary is None:
index.index_struct.summary = "auto-generated summary" # set before use Type guard
def has_summary(index_struct) -> bool:
return getattr(index_struct, "summary", None) is not None Try / catch
try:
summary = index.index_struct.get_summary()
except ValueError:
summary = "(no summary available)" # and consider backfilling index.index_struct.summary Prevention
- Always pass a summary when building/persisting indexes (index.set(..., summary=...))
- After load_index_from_storage on old data, check and backfill summary before querying
- When sharing persisted indexes, re-save them with a current library version so summary is included
When it happens
Trigger: Calling index.index_struct.get_summary() (directly or via code paths like tree/graph index retrieval that embed the summary in a prompt) on an IndexStruct/IndexGraph/KeywordTable whose summary field was never set; loading a legacy storage_context.json that predates the summary field.
Common situations: Loading an index persisted by an old llama_index (pre-0.x rename) version where summary was not written; building IndexStruct dataclasses manually; loading an index someone else shared that was saved without a summary.
Related errors
- ref_doc_id of node cannot be None when building a document s
- Could not extract tool use from input text: {input_text}
- 'handoff' is a reserved tool name. Please use a different na
- Got empty streaming response
- ChatMessage contains multiple blocks, use 'ChatMessage.block
AI-assisted analysis of run-llama/llama_index@afd0fef371 (2026-08-15).
Data as JSON: /api/errors/1cef70d9e606dc86.
Report an issue: GitHub.