{"record":{"id":"a507be762bc87eee","repo":"chroma-core/chroma","slug":"or-cannot-be-combined-with-other-fields-in-the-sa","errorCode":null,"errorMessage":"$or cannot be combined with other fields in the same dict","messagePattern":"\\$or cannot be combined with other fields in the same dict","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"chromadb/execution/expression/operator.py","lineNumber":124,"sourceCode":"                raise ValueError(\n                    \"$and cannot be combined with other fields in the same dict\"\n                )\n\n            conditions = [Where.from_dict(c) for c in data[\"$and\"]]\n            if len(conditions) == 1:\n                return conditions[0]\n            result = conditions[0]\n            for c in conditions[1:]:\n                result = result & c\n            return result\n\n        elif \"$or\" in data:\n            if not isinstance(data[\"$or\"], list):\n                raise TypeError(f\"$or must be a list, got {type(data['$or']).__name__}\")\n            if len(data[\"$or\"]) == 0:\n                raise ValueError(\"$or requires at least one condition\")\n            if len(data) > 1:\n                raise ValueError(\n                    \"$or cannot be combined with other fields in the same dict\"\n                )\n\n            conditions = [Where.from_dict(c) for c in data[\"$or\"]]\n            if len(conditions) == 1:\n                return conditions[0]\n            result = conditions[0]\n            for c in conditions[1:]:\n                result = result | c\n            return result\n\n        else:\n            # Single field condition\n            if len(data) != 1:\n                raise ValueError(\n                    f\"Where dict must contain exactly one field, got {len(data)}\"\n                )\n","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/execution/expression/operator.py#L106-L142","documentation":"Raised by Where.from_dict when a dict contains '$or' alongside other keys. Logical operators cannot be mixed with field conditions (or each other) in the same where dict; each operator must be the sole entry of its dict.","triggerScenarios":"Thrown at chromadb/execution/expression/operator.py:124 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fold sibling field conditions into the $or list as separate condition dicts","Use explicit nested $and/$or structures for combined logic"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","contentChangedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}