chroma-core/chroma · error · ValueError
Aggregate dict must contain exactly one operator, got {len(d
Error message
Aggregate dict must contain exactly one operator, got {len(data)} What it means
Error "Aggregate dict must contain exactly one operator, got {len(data)}" thrown in chroma-core/chroma.
Source
Thrown at chromadb/execution/expression/operator.py:1416
"""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}")
@dataclass
class MinK(Aggregate):
"""Keep k records with minimum aggregate key values per group"""View on GitHub (pinned to aecdd12c8a)
When it happens
Trigger: Thrown at chromadb/execution/expression/operator.py:1416 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/ae83bca9ef2951ca.
Report an issue: GitHub.