{"record":{"id":"ae1b82c6ed076048","repo":"chroma-core/chroma","slug":"aggregate-dict-cannot-be-empty","errorCode":null,"errorMessage":"Aggregate dict cannot be empty","messagePattern":"Aggregate dict cannot be empty","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"chromadb/execution/expression/operator.py","lineNumber":1413,"sourceCode":"    \"\"\"\n\n    def to_dict(self) -> Dict[str, Any]:\n        \"\"\"Convert the Aggregate expression to a dictionary for JSON serialization\"\"\"\n        raise NotImplementedError(\"Subclasses must implement to_dict()\")\n\n    @staticmethod\n    def from_dict(data: Dict[str, Any]) -> \"Aggregate\":\n        \"\"\"Create Aggregate expression from dictionary.\n\n        Supports:\n        - {\"$min_k\": {\"keys\": [...], \"k\": n}} -> MinK(keys=[...], k=n)\n        - {\"$max_k\": {\"keys\": [...], \"k\": n}} -> MaxK(keys=[...], k=n)\n        \"\"\"\n        if not isinstance(data, dict):\n            raise TypeError(f\"Expected dict for Aggregate, got {type(data).__name__}\")\n\n        if not data:\n            raise ValueError(\"Aggregate dict cannot be empty\")\n\n        if len(data) != 1:\n            raise ValueError(\n                f\"Aggregate dict must contain exactly one operator, got {len(data)}\"\n            )\n\n        op = next(iter(data.keys()))\n\n        if op == \"$min_k\":\n            keys, k = _parse_k_aggregate(op, data)\n            return MinK(keys=keys, k=k)\n        elif op == \"$max_k\":\n            keys, k = _parse_k_aggregate(op, data)\n            return MaxK(keys=keys, k=k)\n        else:\n            raise ValueError(f\"Unknown aggregate operator: {op}\")\n\n","sourceCodeStart":1395,"sourceCodeEnd":1431,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/execution/expression/operator.py#L1395-L1431","documentation":"Error \"Aggregate dict cannot be empty\" thrown in chroma-core/chroma.","triggerScenarios":"Thrown at chromadb/execution/expression/operator.py:1413 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}