chroma-core/chroma · error · TypeError
Expected dict for Aggregate, got {type(data).__name__}
Error message
Expected dict for Aggregate, got {type(data).__name__} What it means
Error "Expected dict for Aggregate, got {type(data).__name__}" thrown in chroma-core/chroma.
Source
Thrown at chromadb/execution/expression/operator.py:1410
# Keep bottom 2 by score per group
MaxK(keys=Key.SCORE, k=2)
"""
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:View on GitHub (pinned to aecdd12c8a)
When it happens
Trigger: Thrown at chromadb/execution/expression/operator.py:1410 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/e4ebea5d315445f2.
Report an issue: GitHub.