microsoft/semantic-kernel · error · VectorStoreOperationException

Field '{node.id}' not in data model (storage property names

Error message

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

What it means

A VectorStoreOperationException raised by _lambda_parser when an ast.Name node's id is not in self.definition.storage_names. Unlike attribute access (x.field), a bare Name (e.g. a variable referenced without a qualifier) is only permitted if it resolves to a known storage property name. This catches filters that reference undefined variables or unqualified property names.

Source

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

                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
                raise VectorStoreOperationException(f"Unsupported constant type: {type(value)}")
        raise NotImplementedError(f"Unsupported AST node: {type(node)}")


@release_candidate
class ChromaStore(VectorStore):
    """Chroma vector store."""

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Qualify the field with the lambda parameter: use 'x.tag' instead of 'tag'.
  2. Ensure the referenced name matches a declared storage property name in the definition.

Example fix

// before
lambda x: tag == "foo"   # bare Name 'tag' not in storage_names
// after
lambda x: x.tag == "foo"  # qualified attribute access
Defensive patterns

Strategy: validation

Validate before calling

valid = set(definition.storage_names)
tree = ast.parse(filter_lambda_src, mode="eval")
free_names = {n.id for n in ast.walk(tree) if isinstance(n, ast.Name) and n.id != <lambda_param>}
assert free_names <= valid, f"Filter references unknown names: {free_names - valid}"

Type guard

def name_in_storage_names(definition, name: str) -> bool:
    return name 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):
        # qualify the bare name with the lambda parameter (x.<name>)
        ...

Prevention

When it happens

Trigger: Writing a filter lambda that references a bare name instead of an attribute — e.g. 'lambda x: tag == "foo"' (tag is a Name, not x.tag) — where 'tag' is not a declared storage property; or referencing a captured variable that collides with an intended field name.

Common situations: Forgetting the 'x.' qualifier in a lambda; using a free variable that happens not to be a model field; copy-paste errors leaving a field name unqualified.

Related errors


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