microsoft/semantic-kernel · warning · NotImplementedError
Unsupported BoolOp: {type(op)}
Error message
Unsupported BoolOp: {type(op)} What it means
A NotImplementedError raised by _lambda_parser when a BoolOp uses an operator other than ast.And or ast.Or. Python's ast only defines And and Or for BoolOp, so in practice this branch is effectively unreachable from pure-Python lambda source — but the guard exists for completeness and would fire if the AST were constructed synthetically or by a future grammar change.
Source
Thrown at python/semantic_kernel/connectors/chroma.py:407
case ast.NotEq():
return {left: {"$ne": right}} # type: ignore
case ast.Gt():
return {left: {"$gt": right}} # type: ignore
case ast.GtE():
return {left: {"$gte": right}} # type: ignore
case ast.Lt():
return {left: {"$lt": right}} # type: ignore
case ast.LtE():
return {left: {"$lte": right}} # type: ignore
raise NotImplementedError(f"Unsupported operator: {type(op)}")
case ast.BoolOp():
op = node.op # type: ignore
values = [self._lambda_parser(v) for v in node.values]
if isinstance(op, ast.And):
return {"$and": values}
if isinstance(op, ast.Or):
return {"$or": values}
raise NotImplementedError(f"Unsupported BoolOp: {type(op)}")
case ast.UnaryOp():
raise NotImplementedError("Unary +, -, ~ and ! are not supported in Chroma filters.")
case ast.Attribute():
# Only allow attributes that are in the data model
if node.attr not in self.definition.storage_names:
raise VectorStoreOperationException(
f"Field '{node.attr}' not in data model (storage property names are used)."
)
return node.attr
case ast.Name():
# Only allow names that are in the data model
if node.id not in self.definition.storage_names:
raise VectorStoreOperationException(
f"Field '{node.id}' not in data model (storage property names are used)."
)
return node.id
case ast.Constant():
value = node.valueView on GitHub (pinned to c028a0c7dc)
Solutions
- No action required for normal lambda filters — this guard is defensive.
- If encountered via custom AST, replace the BoolOp.op with ast.And or ast.Or.
Defensive patterns
Strategy: try-catch
Type guard
import ast
def filter_uses_standard_boolops(src: str) -> bool:
tree = ast.parse(src, mode="eval")
return all(isinstance(n.op, (ast.And, ast.Or))
for n in ast.walk(tree) if isinstance(n, ast.BoolOp)) Try / catch
try:
results = await collection.vectorized_search(vector=v, options=opts)
except NotImplementedError as e:
if "Unsupported BoolOp" in str(e):
# report library bug; standard Python cannot reach this branch
... Prevention
- No routine action — this branch is defensive and unreachable from normal Python lambdas.
- Report to the library if it triggers.
When it happens
Trigger: Effectively unreachable from standard Python lambda parsing (Python BoolOp.op is always And or Or). Could fire only if a custom/manually-built AST node is fed to _lambda_parser.
Common situations: Not encountered in normal use; present as a defensive guard. No user action expected beyond updating the library if Python grammar ever adds a boolean operator.
Related errors
- Unsupported operator: {type(op)}
- Unary +, -, ~ and ! are not supported in Chroma filters.
- Field '{node.attr}' not in data model (storage property name
- Field '{node.id}' not in data model (storage property names
- Unsupported constant type: {type(value)}
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/7bb54ac9be71724d.
Report an issue: GitHub.