{"record":{"id":"3df296ddf60d6601","repo":"microsoft/semantic-kernel","slug":"none-values-are-not-supported","errorCode":null,"errorMessage":"None values are not supported.","messagePattern":"None values are not supported\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/connectors/_search_shared.py","lineNumber":37,"sourceCode":"        self.filters: list[dict[str, str]] = []\n        self.valid_parameters = valid_parameters\n\n    @override\n    def visit_Lambda(self, node):\n        self.visit(node.body)\n\n    @override\n    def visit_Compare(self, node):\n        # Only support x.FIELD == VALUE\n        if not (isinstance(node.left, ast.Attribute) and isinstance(node.left.value, ast.Name)):\n            raise NotImplementedError(\"Left side must be x.FIELD.\")\n        field = node.left.attr\n        if not (len(node.ops) == 1 and isinstance(node.ops[0], ast.Eq)):\n            raise NotImplementedError(\"Only == comparisons are supported.\")\n        right = node.comparators[0]\n        if isinstance(right, ast.Constant):\n            if right.value is None:\n                raise NotImplementedError(\"None values are not supported.\")\n            value = str(right.value)\n        else:\n            raise NotImplementedError(\"Only constant values are supported on the right side.\")\n        if field not in self.valid_parameters:\n            raise ValueError(f\"Field '{field}' is not supported.\")\n        self.filters.append({field: quote_plus(value)})\n\n    @override\n    def visit_BoolOp(self, node):\n        if not isinstance(node.op, ast.And):\n            raise NotImplementedError(\"Only 'and' of == comparisons is supported.\")\n        for v in node.values:\n            self.visit(v)\n","sourceCodeStart":19,"sourceCodeEnd":51,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/_search_shared.py#L19-L51","documentation":"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.","triggerScenarios":"Writing `lambda x: x.field == None` (or `is None`) in a search filter lambda.","commonSituations":"Trying to filter for empty/null fields; copying Python idiom `== None`.","solutions":["Do not test against None in search filter lambdas; these APIs have no null-equality filter.","If you need to exclude a field, filter client-side after results return, or use a concrete sentinel value the provider supports."],"exampleFix":"// before\nlambda x: x.category == None\n\n// after\nlambda x: x.category == \"news\"  # use a concrete value; null filtering is unsupported","handlingStrategy":"validation","validationCode":"import ast\nnode = ast.parse(filter_src, mode='eval').body\ndef check_none(n):\n    if isinstance(n, ast.Compare):\n        r = n.comparators[0]\n        assert not (isinstance(r, ast.Constant) and r.value is None), 'None not supported'\n    if isinstance(n, ast.BoolOp):\n        for v in n.values: check_none(v)\ncheck_none(node.body)","typeGuard":"def rhs_is_not_none(node: ast.Compare) -> bool:\n    r = node.comparators[0]\n    return not (isinstance(r, ast.Constant) and r.value is None)","tryCatchPattern":null,"preventionTips":["Never compare against None in search filter lambdas","Filter for concrete values only","Handle null/empty cases client-side after the query"],"tags":["search","filters","lambda","ast"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}