{"record":{"id":"e4ebea5d315445f2","repo":"chroma-core/chroma","slug":"expected-dict-for-aggregate-got-type-data-nam","errorCode":null,"errorMessage":"Expected dict for Aggregate, got {type(data).__name__}","messagePattern":"Expected dict for Aggregate, got (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"chromadb/execution/expression/operator.py","lineNumber":1410,"sourceCode":"\n        # Keep bottom 2 by score per group\n        MaxK(keys=Key.SCORE, k=2)\n    \"\"\"\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:","sourceCodeStart":1392,"sourceCodeEnd":1428,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/execution/expression/operator.py#L1392-L1428","documentation":"Error \"Expected dict for Aggregate, got {type(data).__name__}\" thrown in chroma-core/chroma.","triggerScenarios":"Thrown at chromadb/execution/expression/operator.py:1410 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"}