{"record":{"id":"7fad7faf288a1493","repo":"run-llama/llama_index","slug":"embedding-not-set","errorCode":null,"errorMessage":"embedding not set.","messagePattern":"embedding not set\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/schema.py","lineNumber":491,"sourceCode":"\n    def __str__(self) -> str:\n        source_text_truncated = truncate_text(\n            self.get_content().strip(), TRUNCATE_LENGTH\n        )\n        source_text_wrapped = textwrap.fill(\n            f\"Text: {source_text_truncated}\\n\", width=WRAP_WIDTH\n        )\n        return f\"Node ID: {self.node_id}\\n{source_text_wrapped}\"\n\n    def get_embedding(self) -> List[float]:\n        \"\"\"\n        Get embedding.\n\n        Errors if embedding is None.\n\n        \"\"\"\n        if self.embedding is None:\n            raise ValueError(\"embedding not set.\")\n        return self.embedding\n\n    def as_related_node_info(self) -> RelatedNodeInfo:\n        \"\"\"Get node as RelatedNodeInfo.\"\"\"\n        return RelatedNodeInfo(\n            node_id=self.node_id,\n            node_type=self.get_type(),\n            metadata=self.metadata,\n            hash=self.hash,\n        )\n\n\nEmbeddingKind = Literal[\"sparse\", \"dense\"]\n\n\nclass MediaResource(BaseModel):\n    \"\"\"\n    A container class for media content.","sourceCodeStart":473,"sourceCodeEnd":509,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/schema.py#L473-L509","documentation":"BaseNode.get_embedding() raises ValueError when the node's embedding field is None. The API intentionally errors instead of returning None because callers (vector stores, similarity rerankers) require an actual vector; nodes created by parsers start with embedding=None until an embedding model runs on them.","triggerScenarios":"Calling node.get_embedding() on a node that was never embedded — i.e., created via TextNode()/SentenceSplitter but not passed through Settings.embedding_model.get_text_embedding or an ingestion pipeline embedding step.","commonSituations":"Custom retrieval or reranking code that inspects node embeddings after loading un-embedded nodes from a docstore; building a vector index but reading nodes from the wrong (non-embedded) copy.","solutions":["Embed first: node.embedding = Settings.embedding_model.get_text_embedding(node.get_content())","Run nodes through an IngestionPipeline with an embedding transform before touching embeddings","If a node may legitimately lack an embedding, check node.embedding is None yourself instead of calling get_embedding()"],"exampleFix":"# before\nvec = node.get_embedding()  # ValueError if never embedded\n\n# after\nif node.embedding is None:\n    node.embedding = Settings.embedding_model.get_text_embedding(node.get_content())\nvec = node.get_embedding()","handlingStrategy":"validation","validationCode":"if node.embedding is None:\n    node.embedding = Settings.embedding_model.get_text_embedding(node.get_content())","typeGuard":"def is_embedded(node) -> bool:\n    return node.embedding is not None","tryCatchPattern":null,"preventionTips":["Embed nodes during ingestion via IngestionPipeline, not lazily at read time","Check .embedding is None before get_embedding()","Keep a single node source so you never read un-embedded copies"],"tags":["schema","embeddings","nodes"],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}