run-llama/llama_index · error · ValueError

Playground must be initialized with a nonempty list of Docum

Error message

Playground must be initialized with a nonempty list of Documents.

What it means

Error "Playground must be initialized with a nonempty list of Documents." thrown in run-llama/llama_index.

Source

Thrown at llama-index-core/llama_index/core/playground/base.py:74

        self.index_colors = get_color_mapping(index_range)

    @classmethod
    def from_docs(
        cls,
        documents: List[Document],
        index_classes: List[Type[BaseIndex]] = DEFAULT_INDEX_CLASSES,
        retriever_modes: INDEX_SPECIFIC_QUERY_MODES_TYPE = DEFAULT_MODES,
        **kwargs: Any,
    ) -> Playground:
        """
        Initialize with Documents using the default list of indices.

        Args:
            documents: A List of Documents to experiment with.

        """
        if len(documents) == 0:
            raise ValueError(
                "Playground must be initialized with a nonempty list of Documents."
            )

        indices = [
            index_class.from_documents(documents, **kwargs)
            for index_class in index_classes
        ]
        return cls(indices, retriever_modes)

    def _validate_indices(self, indices: List[BaseIndex]) -> None:
        """Validate a list of indices."""
        if len(indices) == 0:
            raise ValueError("Playground must have a non-empty list of indices.")
        for index in indices:
            if not isinstance(index, BaseIndex):
                raise ValueError(
                    "Every index in Playground should be an instance of BaseIndex."
                )

View on GitHub (pinned to afd0fef371)

Solutions

  1. Initialize Playground with a non-empty list of Document objects.
  2. Load documents first and pass them to the Playground constructor.

When it happens

Trigger: Thrown at llama-index-core/llama_index/core/playground/base.py:74 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/2b50f8206d6edffa. Report an issue: GitHub.