zylon-ai/private-gpt · error · ValueError

Hybrid search is not enabled. Please build the query with `e

Error message

Hybrid search is not enabled. Please build the query with `enable_hybrid=True` in the constructor.

What it means

ValueError raised by the synchronous query path of PatchedQdrantVectorStore when a query is issued with VectorStoreQueryMode.HYBRID but the store was constructed with enable_hybrid=False. Hybrid search requires named dense+sparse vectors configured at collection build time, which only happens when enable_hybrid=True, so it cannot be toggled per query.

Source

Thrown at private_gpt/components/vector_store/patched_qdrant_store.py:1037

        Args:
            query (VectorStoreQuery): query
            **kwargs: additional keyword arguments to pass to the query

        """
        query_embedding = cast(list[float], query.query_embedding)

        with_payload = kwargs.pop("with_payload", True)
        with_vector = kwargs.pop("with_vectors", False)
        score_threshold = kwargs.pop("score_threshold", None)

        qdrant_filters = kwargs.get("qdrant_filters")
        if qdrant_filters is not None:
            query_filter = qdrant_filters
        else:
            query_filter = cast(Filter, self._build_query_filter(query))

        if query.mode == VectorStoreQueryMode.HYBRID and not self.enable_hybrid:
            raise ValueError(
                "Hybrid search is not enabled. Please build the query with "
                "`enable_hybrid=True` in the constructor."
            )
        elif (
            query.mode == VectorStoreQueryMode.HYBRID
            and self.enable_hybrid
            and self._sparse_query_fn is not None
            and query.query_str is not None
        ):
            sparse_indices, sparse_embedding = self._sparse_query_fn(
                [query.query_str],
            )
            sparse_top_k = query.sparse_top_k or query.similarity_top_k

            sparse_response = self._client.query_batch_points(
                collection_name=self.collection_name,
                requests=[
                    rest.QueryRequest(

View on GitHub (pinned to 4a030776a3)

Solutions

  1. Rebuild/reconfigure the store with enable_hybrid=True in the constructor (this also sets dense/sparse vector names and re-initializes the collection layout)
  2. Or query with a non-hybrid mode (DEFAULT/SPARSE as supported) on a dense-only store
  3. Recreate the Qdrant collection if it predates named-vector hybrid layout

Example fix

# before
store = PatchedQdrantVectorStore(collection_name="docs")
res = store.query(Query(mode=VectorStoreQueryMode.HYBRID, ...))
# after
store = PatchedQdrantVectorStore(collection_name="docs", enable_hybrid=True)
res = store.query(Query(mode=VectorStoreQueryMode.HYBRID, ...))
Defensive patterns

Strategy: validation

Validate before calling

def assert_hybrid_capable(store) -> None:
    if not getattr(store, "enable_hybrid", False):
        raise ValueError("store built without enable_hybrid=True; cannot run HYBRID queries")

Type guard

def store_supports_hybrid(store: object) -> bool:
    return bool(getattr(store, "enable_hybrid", False))

Try / catch

try:
    res = store.query(q)
except ValueError as e:
    if "Hybrid search is not enabled" in str(e):
        # rebuild store with enable_hybrid=True or downgrade query mode
        raise

Prevention

When it happens

Trigger: Constructing the store without enable_hybrid=True (legacy unnamed-vector layout, see LEGACY_UNNAMED_VECTOR branch) and then calling query() with query.mode = VectorStoreQueryMode.HYBRID.

Common situations: Adding a hybrid query to code that reuses an existing store built for dense-only search; enabling hybrid in retrieval settings but not in the vector store factory settings; legacy collections created before hybrid support.

Related errors


AI-assisted analysis of zylon-ai/private-gpt@4a030776a3 (2026-08-15). Data as JSON: /api/errors/6a9f9f5b8adb6f4b. Report an issue: GitHub.