chroma-core/chroma · error · ValueError
Unknown operator
Error message
Unknown operator: {op} What it means
ValueError in Where.from_dict: the operator key in the field's condition dict is not one of the supported operators ($eq, $ne, $gt, $gte, $lt, $lte, $in, $nin, $contains, $not_contains, $regex, $not_regex). Fires on typos like '$equal' or unsupported custom operators.
Solutions
- Use one of the documented operators ($eq, $ne, $gt, $gte, $lt, $lte, $in, $nin, $contains, $not_contains, $regex, $not_regex)
- Check for typos in the operator name
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at chromadb/execution/expression/operator.py:212 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16).
Data as JSON: /api/errors/3295d15b66908747.
Report an issue: GitHub.
Appendix: source
Thrown at chromadb/execution/expression/operator.py:212
if not isinstance(value, (str, int, float, bool)):
raise TypeError(
f"$not_contains requires a str, int, float, or bool, got {type(value).__name__}"
)
return Key(field).not_contains(value)
elif op == "$regex":
if not isinstance(value, str):
raise TypeError(
f"$regex requires a string pattern, got {type(value).__name__}"
)
return Key(field).regex(value)
elif op == "$not_regex":
if not isinstance(value, str):
raise TypeError(
f"$not_regex requires a string pattern, got {type(value).__name__}"
)
return Key(field).not_regex(value)
else:
raise ValueError(f"Unknown operator: {op}")
else:
# Direct value is shorthand for equality
return Key(field) == condition
def __and__(self, other: "Where") -> "And":
"""Overload & operator for AND"""
# If self is already an And, extend it
if isinstance(self, And):
# If other is also And, combine all conditions
if isinstance(other, And):
return And(self.conditions + other.conditions)
return And(self.conditions + [other])
# If other is And, prepend self to it
elif isinstance(other, And):
return And([self] + other.conditions)
# Create new And with both conditions
return And([self, other])
View on GitHub (pinned to aecdd12c8a)