RyanCodrai/turbovec · error · ValueError

Invalid filter syntax. See https://docs.haystack.deepset.ai/

Error message

Invalid filter syntax. See https://docs.haystack.deepset.ai/docs/metadata-filtering for details.

What it means

Raised by the static _validate_filters helper when a filter dict has neither a top-level 'operator' nor 'conditions' key — e.g. a bare {'field': 'value'} without an operator. It matches InMemoryDocumentStore's rejection of malformed Haystack filter syntax and is called by every filter-consuming method.

Source

Thrown at turbovec-python/python/turbovec/haystack.py:572

                for data in docs_data
                if key in data["meta"] and data["meta"][key] is not None
            },
            key=str,
        )
        return values, len(values)

    @staticmethod
    def _validate_filters(filters: Optional[Dict[str, Any]]) -> None:
        # Match InMemoryDocumentStore (document_store.py:504-509): a
        # filter dict must have a top-level "operator" (simple comparison
        # or logical) or "conditions" (compound). A bare "field" without
        # an operator is malformed and the reference rejects it; we do too.
        if (
            filters
            and "operator" not in filters
            and "conditions" not in filters
        ):
            raise ValueError(
                "Invalid filter syntax. See https://docs.haystack.deepset.ai/docs/metadata-filtering for details."
            )

    # ---- Retrieval (not in core protocol but expected) ----------------

    def embedding_retrieval(
        self,
        query_embedding: List[float],
        filters: Optional[Dict[str, Any]] = None,
        top_k: int = 10,
        scale_score: bool = False,
        return_embedding: Optional[bool] = None,
    ) -> List[Document]:
        """Return the ``top_k`` documents most similar to ``query_embedding``.

        ``return_embedding=None`` (default) honours the store-level
        ``return_embedding`` set in the constructor. turbovec never has
        the full-precision embedding either way — the parameter is here

View on GitHub (pinned to ccab9f325e)

Solutions

  1. Use Haystack filter syntax: {'operator': 'AND'/'OR', 'conditions': [...]} or a simple {'field': {'operator': '==', 'value': ...}}.
  2. Consult the linked Haystack metadata-filtering docs for the accepted shapes.
  3. Catch the ValueError in retrieval code to report malformed filters to pipeline authors.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at turbovec-python/python/turbovec/haystack.py:572 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of RyanCodrai/turbovec@ccab9f325e (2026-09-06). Data as JSON: /api/errors/9f052bf9c56cdfbb. Report an issue: GitHub.