microsoft/semantic-kernel · error · VectorStoreOperationException

Field '{node.attr}' not in data model (storage property name

Error message

Field '{node.attr}' not in data model (storage property names are used).

What it means

A VectorStoreOperationException raised by _lambda_parser when an ast.Attribute node references an attribute name not present in self.definition.storage_names. The filter translator only allows attribute access (e.g. x.field) on properties that exist in the data model using their storage (column) names, preventing arbitrary attribute traversal and injection.

Source

Thrown at python/semantic_kernel/connectors/chroma.py:413

                    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.value
                if isinstance(value, str):
                    return value.replace("'", "''")
                if isinstance(value, bytes):
                    return value.decode("utf-8").replace("'", "''")
                if isinstance(value, (int, float, bool)) or value is None:
                    return value

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Reference only storage property names declared in the VectorStoreCollectionDefinition (check definition.storage_names).
  2. If the field was renamed, update the lambda to use the current storage name, or add the field back to the model.

Example fix

// before
lambda x: x.title == "foo"   # 'title' not in storage_names
// after
lambda x: x.name == "foo"    # use the declared storage name
Defensive patterns

Strategy: validation

Validate before calling

valid = set(definition.storage_names)
tree = ast.parse(filter_lambda_src, mode="eval")
attrs = {n.attr for n in ast.walk(tree) if isinstance(n, ast.Attribute)}
assert attrs <= valid, f"Filter references unknown fields: {attrs - valid}"

Type guard

def attribute_in_storage_names(definition, attr: str) -> bool:
    return attr in set(definition.storage_names)

Try / catch

from semantic_kernel.exceptions.vector_store_exceptions import VectorStoreOperationException
try:
    results = await collection.vectorized_search(vector=v, options=opts)
except VectorStoreOperationException as e:
    if "not in data model" in str(e):
        # correct the attribute name to a declared storage name
        ...

Prevention

When it happens

Trigger: Writing a filter lambda that accesses a property not declared in the record model, or using the Python property name when the storage name differs (e.g. accessing x.title when the field is stored as 'name', or referencing a computed/non-stored attribute).

Common situations: Renaming a storage property without updating filter lambdas; filtering on a field that was dropped from the model; using the public attribute name while the definition maps it to a different storage_name.

Related errors


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