microsoft/semantic-kernel · error · NotImplementedError

None values are not supported.

Error message

None values are not supported.

What it means

Even when the right side is an ast.Constant, a None literal is explicitly rejected. The visitor stringifies the constant value and cannot represent a null filter, so `right.value is None` raises NotImplementedError.

Source

Thrown at python/semantic_kernel/connectors/_search_shared.py:37

        self.filters: list[dict[str, str]] = []
        self.valid_parameters = valid_parameters

    @override
    def visit_Lambda(self, node):
        self.visit(node.body)

    @override
    def visit_Compare(self, node):
        # Only support x.FIELD == VALUE
        if not (isinstance(node.left, ast.Attribute) and isinstance(node.left.value, ast.Name)):
            raise NotImplementedError("Left side must be x.FIELD.")
        field = node.left.attr
        if not (len(node.ops) == 1 and isinstance(node.ops[0], ast.Eq)):
            raise NotImplementedError("Only == comparisons are supported.")
        right = node.comparators[0]
        if isinstance(right, ast.Constant):
            if right.value is None:
                raise NotImplementedError("None values are not supported.")
            value = str(right.value)
        else:
            raise NotImplementedError("Only constant values are supported on the right side.")
        if field not in self.valid_parameters:
            raise ValueError(f"Field '{field}' is not supported.")
        self.filters.append({field: quote_plus(value)})

    @override
    def visit_BoolOp(self, node):
        if not isinstance(node.op, ast.And):
            raise NotImplementedError("Only 'and' of == comparisons is supported.")
        for v in node.values:
            self.visit(v)

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Do not test against None in search filter lambdas; these APIs have no null-equality filter.
  2. If you need to exclude a field, filter client-side after results return, or use a concrete sentinel value the provider supports.

Example fix

// before
lambda x: x.category == None

// after
lambda x: x.category == "news"  # use a concrete value; null filtering is unsupported
Defensive patterns

Strategy: validation

Validate before calling

import ast
node = ast.parse(filter_src, mode='eval').body
def check_none(n):
    if isinstance(n, ast.Compare):
        r = n.comparators[0]
        assert not (isinstance(r, ast.Constant) and r.value is None), 'None not supported'
    if isinstance(n, ast.BoolOp):
        for v in n.values: check_none(v)
check_none(node.body)

Type guard

def rhs_is_not_none(node: ast.Compare) -> bool:
    r = node.comparators[0]
    return not (isinstance(r, ast.Constant) and r.value is None)

Prevention

When it happens

Trigger: Writing `lambda x: x.field == None` (or `is None`) in a search filter lambda.

Common situations: Trying to filter for empty/null fields; copying Python idiom `== None`.

Related errors


AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13). Data as JSON: /api/errors/3df296ddf60d6601. Report an issue: GitHub.