run-llama/llama_index · error · ValueError

metadata is None

Error message

metadata is None

What it means

Error "metadata is None" thrown in run-llama/llama_index.

Source

Thrown at llama-index-core/llama_index/core/postprocessor/node_recency.py:198

        return "TimeWeightedPostprocessor"

    def _postprocess_nodes(
        self,
        nodes: List[NodeWithScore],
        query_bundle: Optional[QueryBundle] = None,
    ) -> List[NodeWithScore]:
        """Postprocess nodes."""
        now = self.now or datetime.now().timestamp()
        # TODO: refactor with get_top_k_embeddings

        similarities = []
        for node_with_score in nodes:
            # embedding similarity score
            score = node_with_score.score or 1.0
            node = node_with_score.node
            # time score
            if node.metadata is None:
                raise ValueError("metadata is None")

            last_accessed = node.metadata.get(self.last_accessed_key, None)
            if last_accessed is None:
                last_accessed = now

            hours_passed = (now - last_accessed) / 3600
            time_similarity = (1 - self.time_decay) ** hours_passed

            similarity = score + time_similarity

            similarities.append(similarity)

        sorted_tups = sorted(zip(similarities, nodes), key=lambda x: x[0], reverse=True)

        top_k = min(self.top_k, len(sorted_tups))
        result_tups = sorted_tups[:top_k]
        result_nodes = [
            NodeWithScore(node=n.node, score=score) for score, n in result_tups

View on GitHub (pinned to afd0fef371)

Solutions

  1. Set metadata (including a date field) on the nodes before recency postprocessing.
  2. Ensure nodes carry the required metadata key used by the recency sorter.

When it happens

Trigger: Thrown at llama-index-core/llama_index/core/postprocessor/node_recency.py:198 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/a8dc1f5f045a4cc8. Report an issue: GitHub.