{"record":{"id":"dd9688b9399b709e","repo":"chroma-core/chroma","slug":"expected-dict-for-groupby-got-type-data-name","errorCode":null,"errorMessage":"Expected dict for GroupBy, got {type(data).__name__}","messagePattern":"Expected dict for GroupBy, got (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"chromadb/execution/expression/operator.py","lineNumber":1510,"sourceCode":"    def to_dict(self) -> Dict[str, Any]:\n        \"\"\"Convert the GroupBy to a dictionary for JSON serialization\"\"\"\n        # Default GroupBy (no keys, no aggregate) serializes to {}\n        if not self.keys or self.aggregate is None:\n            return {}\n        result: Dict[str, Any] = {\"keys\": _keys_to_strings(self.keys)}\n        result[\"aggregate\"] = self.aggregate.to_dict()\n        return result\n\n    @staticmethod\n    def from_dict(data: Dict[str, Any]) -> \"GroupBy\":\n        \"\"\"Create GroupBy from dictionary.\n\n        Examples:\n        - {} -> GroupBy() (default, no grouping)\n        - {\"keys\": [\"category\"], \"aggregate\": {\"$min_k\": {\"keys\": [\"#score\"], \"k\": 3}}}\n        \"\"\"\n        if not isinstance(data, dict):\n            raise TypeError(f\"Expected dict for GroupBy, got {type(data).__name__}\")\n\n        # Empty dict returns default GroupBy (no grouping)\n        if not data:\n            return GroupBy()\n\n        # Non-empty dict requires keys and aggregate\n        if \"keys\" not in data:\n            raise ValueError(\"GroupBy requires 'keys' field\")\n        if \"aggregate\" not in data:\n            raise ValueError(\"GroupBy requires 'aggregate' field\")\n\n        keys = data[\"keys\"]\n        if not isinstance(keys, (list, tuple)):\n            raise TypeError(f\"GroupBy keys must be a list, got {type(keys).__name__}\")\n        if not keys:\n            raise ValueError(\"GroupBy keys cannot be empty\")\n\n        aggregate_data = data[\"aggregate\"]","sourceCodeStart":1492,"sourceCodeEnd":1528,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/execution/expression/operator.py#L1492-L1528","documentation":"Error \"Expected dict for GroupBy, got {type(data).__name__}\" thrown in chroma-core/chroma.","triggerScenarios":"Thrown at chromadb/execution/expression/operator.py:1510 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"}