chroma-core/chroma · error · ValueError

Aggregate dict cannot be empty

Error message

Aggregate dict cannot be empty

What it means

Error "Aggregate dict cannot be empty" thrown in chroma-core/chroma.

Source

Thrown at chromadb/execution/expression/operator.py:1413

    """

    def to_dict(self) -> Dict[str, Any]:
        """Convert the Aggregate expression to a dictionary for JSON serialization"""
        raise NotImplementedError("Subclasses must implement to_dict()")

    @staticmethod
    def from_dict(data: Dict[str, Any]) -> "Aggregate":
        """Create Aggregate expression from dictionary.

        Supports:
        - {"$min_k": {"keys": [...], "k": n}} -> MinK(keys=[...], k=n)
        - {"$max_k": {"keys": [...], "k": n}} -> MaxK(keys=[...], k=n)
        """
        if not isinstance(data, dict):
            raise TypeError(f"Expected dict for Aggregate, got {type(data).__name__}")

        if not data:
            raise ValueError("Aggregate dict cannot be empty")

        if len(data) != 1:
            raise ValueError(
                f"Aggregate dict must contain exactly one operator, got {len(data)}"
            )

        op = next(iter(data.keys()))

        if op == "$min_k":
            keys, k = _parse_k_aggregate(op, data)
            return MinK(keys=keys, k=k)
        elif op == "$max_k":
            keys, k = _parse_k_aggregate(op, data)
            return MaxK(keys=keys, k=k)
        else:
            raise ValueError(f"Unknown aggregate operator: {op}")

View on GitHub (pinned to aecdd12c8a)

When it happens

Trigger: Thrown at chromadb/execution/expression/operator.py:1413 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16). Data as JSON: /api/errors/ae1b82c6ed076048. Report an issue: GitHub.