zylon-ai/private-gpt · error · ValueError

group_id must be provided for logical multitenancy

Error message

group_id must be provided for logical multitenancy

What it means

ValueError raised by PatchedQdrantVectorStore.__init__ when logical_multitenancy=True but no group_id was supplied. In logical multitenancy mode every write must be tagged with a group_id (stored under group_id_field, default DEFAULT_GROUP_ID_FIELD), so a missing group makes the store unusable by construction.

Source

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

        )
        # Init client after, to avoid to call exist collection
        self._client = client
        self._aclient = aclient

        # Set flag os legacy
        self._legacy_vector_format = True
        if self.enable_hybrid:
            self.dense_vector_name = DEFAULT_DENSE_VECTOR_NAME
            self.sparse_vector_name = DEFAULT_SPARSE_VECTOR_NAME_OLD
        else:
            self.dense_vector_name = LEGACY_UNNAMED_VECTOR

        # Init multi-tenancy
        self._logical_multitenancy = logical_multitenancy
        self._group_id = group_id
        self._group_id_field = group_id_field or DEFAULT_GROUP_ID_FIELD
        if self._logical_multitenancy and not self._group_id:
            raise ValueError("group_id must be provided for logical multitenancy")

        # Init collection
        self._init_collection(
            collection_name,
            enable_hybrid,
            embed_dim,
            models.Distance[distance.upper()],
            logical_multitenancy,
            hnsw_m,
            hnsw_payload_m,
            indexes,
            on_disk,
        )

        # setup hybrid search if enabled
        if enable_hybrid or fastembed_sparse_model is not None:
            self._sparse_doc_fn = sparse_doc_fn or self.get_default_sparse_doc_encoder(
                collection_name, fastembed_sparse_model=fastembed_sparse_model

View on GitHub (pinned to 4a030776a3)

Solutions

  1. Provide group_id whenever logical multitenancy is enabled (constructor arg or the corresponding settings field consumed by the factory)
  2. Or set vectorstore.multitenancy back to a mode that does not require a group id
  3. Verify group_id_field default (DEFAULT_GROUP_ID_FIELD) matches the field your payloads use

Example fix

# before
store = PatchedQdrantVectorStore(collection_name="docs", logical_multitenancy=True)
# after
store = PatchedQdrantVectorStore(
    collection_name="docs",
    logical_multitenancy=True,
    group_id="tenant-acme",
)
Defensive patterns

Strategy: validation

Validate before calling

def validate_multitenancy(logical: bool, group_id: str | None) -> None:
    if logical and not group_id:
        raise ValueError("configure group_id before enabling logical multitenancy")

Try / catch

try:
    store = PatchedQdrantVectorStore(collection_name=c, logical_multitenancy=True, group_id=gid)
except ValueError as e:
    if "group_id must be provided" in str(e):
        # fix config and restart; retrying unchanged will not help
        raise

Prevention

When it happens

Trigger: Constructing PatchedQdrantVectorStore (directly or via the factory with settings.vectorstore.multitenancy == 'logical') without passing group_id; enabling logical multitenancy in config while the factory path that supplies group_id was changed or bypassed.

Common situations: Flipping vectorstore.multitenancy to 'logical' in settings without configuring the group id; writing a custom factory that forwards fewer constructor args; assuming group_id is optional in logical mode.

Related errors


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