{"record":{"id":"006e93c785f963c3","repo":"MemPalace/mempalace","slug":"where-document-operator-key-r-not-supported-006e93","errorCode":null,"errorMessage":"where_document operator {key!r} not supported","messagePattern":"where_document operator (.+?) not supported","errorType":"exception","errorClass":"UnsupportedFilterError","httpStatus":null,"severity":"error","filePath":"mempalace/backends/pgvector.py","lineNumber":257,"sourceCode":"def _matches_where_document(document: str, where_document: Optional[dict]) -> bool:\n    if not where_document:\n        return True\n    if not isinstance(where_document, dict):\n        return False\n    for key, value in where_document.items():\n        if key == \"$contains\":\n            if str(value) not in document:\n                return False\n            continue\n        if key == \"$and\":\n            if not all(_matches_where_document(document, clause) for clause in value or []):\n                return False\n            continue\n        if key == \"$or\":\n            if not any(_matches_where_document(document, clause) for clause in value or []):\n                return False\n            continue\n        raise UnsupportedFilterError(f\"where_document operator {key!r} not supported\")\n    return True\n\n\ndef _requires_local_filter(where: Optional[dict], where_document: Optional[dict] = None) -> bool:\n    \"\"\"True when ``where``/``where_document`` cannot be fully pushed to SQL.\n\n    Equality, ``$in``, ``$nin``, ``$ne`` and ``$and`` become JSONB containment\n    predicates; everything else ($or, $contains, comparisons, any\n    where_document) is evaluated on the local exact path so correctness never\n    depends on a hand-rolled SQL cast.\n    \"\"\"\n    if where_document:\n        return True\n    if not where:\n        return False\n    stack = [where]\n    while stack:\n        node = stack.pop()","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/MemPalace/mempalace/blob/06cb6987f02610784fefbad4b2bd5d026d164ba6/mempalace/backends/pgvector.py#L239-L275","documentation":"Error \"where_document operator {key!r} not supported\" thrown in MemPalace/mempalace.","triggerScenarios":"Thrown at mempalace/backends/pgvector.py:257 when the library encounters an invalid state.","commonSituations":"A chroma-style where_document operator was passed that the pgvector backend cannot translate.","solutions":["Use a supported where_document operator for pgvector (e.g. $contains), or move the condition into metadata filters"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"06cb6987f02610784fefbad4b2bd5d026d164ba6","analyzedAt":"2026-08-15T03:03:36.213Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}