{"record":{"id":"cf82b4d8d26f0bbb","repo":"chroma-core/chroma","slug":"groupby-requires-keys-field","errorCode":null,"errorMessage":"GroupBy requires 'keys' field","messagePattern":"GroupBy requires 'keys' field","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"chromadb/execution/expression/operator.py","lineNumber":1518,"sourceCode":"\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\"]\n        if not isinstance(aggregate_data, dict):\n            raise TypeError(\n                f\"GroupBy aggregate must be a dict, got {type(aggregate_data).__name__}\"\n            )\n        aggregate = Aggregate.from_dict(aggregate_data)\n\n        return GroupBy(keys=_strings_to_keys(keys), aggregate=aggregate)\n","sourceCodeStart":1500,"sourceCodeEnd":1536,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/execution/expression/operator.py#L1500-L1536","documentation":"Error \"GroupBy requires 'keys' field\" thrown in chroma-core/chroma.","triggerScenarios":"Thrown at chromadb/execution/expression/operator.py:1518 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"}