microsoft/semantic-kernel · error · ValueError

Field '{field}' is not supported.

Error message

Field '{field}' is not supported.

What it means

Unlike the NotImplementedError cases, this is a ValueError raised when the field name (node.left.attr) is not in the visitor's valid_parameters list. It signals a recognized-shape filter that names a field the connector does not allow.

Source

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

        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. Use only field names the connector advertises as valid filter parameters for that provider.
  2. Check the connector's documented valid filter fields and align the lambda's x.FIELD accordingly.
  3. Remove the unsupported filter if it is not essential.

Example fix

// before
lambda x: x.language == "en"  # if 'language' is not a valid parameter for this connector

// after
lambda x: x.country == "us"  # use a field name in the connector's valid_parameters
Defensive patterns

Strategy: validation

Validate before calling

import ast
node = ast.parse(filter_src, mode='eval').body
def collect_fields(n, out):
    if isinstance(n, ast.Compare) and isinstance(n.left, ast.Attribute):
        out.add(n.left.attr)
    if isinstance(n, ast.BoolOp):
        for v in n.values: collect_fields(v, out)
fields = set(); collect_fields(node.body, fields)
bad = fields - set(valid_parameters)
assert not bad, f'unsupported fields: {bad}'

Type guard

def fields_are_valid(node, valid_parameters: list[str]) -> bool:
    fields = set()
    # collect ast.Attribute attrs as above
    return fields.issubset(set(valid_parameters))

Try / catch

try:
    visitor.visit(ast.parse(filter_src, mode='eval'))
except ValueError as e:
    # unsupported field; drop or rename the filter
    logger.warning('filter field rejected: %s', e)

Prevention

When it happens

Trigger: Writing `lambda x: x.unknown_field == "v"` where 'unknown_field' is not among the valid parameters the search connector passed to SearchLambdaVisitor.

Common situations: Guessing a field name not exposed by the Brave/Google search connector; using a field from a different connector; typo in the field name.

Related errors


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