MemPalace/mempalace · error · UnsupportedFilterError

where_document operator {key!r} not supported

Error message

where_document operator {key!r} not supported

What it means

Error "where_document operator {key!r} not supported" thrown in MemPalace/mempalace.

Source

Thrown at mempalace/backends/pgvector.py:257

def _matches_where_document(document: str, where_document: Optional[dict]) -> bool:
    if not where_document:
        return True
    if not isinstance(where_document, dict):
        return False
    for key, value in where_document.items():
        if key == "$contains":
            if str(value) not in document:
                return False
            continue
        if key == "$and":
            if not all(_matches_where_document(document, clause) for clause in value or []):
                return False
            continue
        if key == "$or":
            if not any(_matches_where_document(document, clause) for clause in value or []):
                return False
            continue
        raise UnsupportedFilterError(f"where_document operator {key!r} not supported")
    return True


def _requires_local_filter(where: Optional[dict], where_document: Optional[dict] = None) -> bool:
    """True when ``where``/``where_document`` cannot be fully pushed to SQL.

    Equality, ``$in``, ``$nin``, ``$ne`` and ``$and`` become JSONB containment
    predicates; everything else ($or, $contains, comparisons, any
    where_document) is evaluated on the local exact path so correctness never
    depends on a hand-rolled SQL cast.
    """
    if where_document:
        return True
    if not where:
        return False
    stack = [where]
    while stack:
        node = stack.pop()

View on GitHub (pinned to 06cb6987f0)

Solutions

  1. Use a supported where_document operator for pgvector (e.g. $contains), or move the condition into metadata filters

When it happens

Trigger: Thrown at mempalace/backends/pgvector.py:257 when the library encounters an invalid state.

Common situations: A chroma-style where_document operator was passed that the pgvector backend cannot translate.


AI-assisted analysis of MemPalace/mempalace@06cb6987f0 (2026-08-15). Data as JSON: /api/errors/006e93c785f963c3. Report an issue: GitHub.