MemPalace/mempalace · error · CollectionNotInitializedError

{collection_name}

Error message

{collection_name}

What it means

Raised by QdrantCollection.query() when the local marker file says the collection should exist but the remote Qdrant collection does not. CollectionNotInitializedError (a PalaceNotFoundError subclass): the palace metadata and the server have diverged — typically the Qdrant data volume was wiped or the collection was deleted server-side while local state still references it.

Source

Thrown at mempalace/backends/qdrant.py:973

        if query_texts is not None:
            raise ValueError("qdrant requires query_embeddings; use palace.get_collection wrapper")
        if query_embeddings is None:
            raise ValueError("query requires query_embeddings")
        if not query_embeddings:
            raise ValueError("query input must be a non-empty list")
        _validate_where(where)
        _validate_where(where_document)
        if _requires_local_filter(where, where_document):
            return self._query_local_exact(
                query_embeddings=query_embeddings,
                n_results=n_results,
                where=where,
                where_document=where_document,
                include=include,
            )
        if not self._remote_exists():
            if self._marker_exists():
                raise CollectionNotInitializedError(self._collection_name)
            return QueryResult.empty(
                num_queries=len(query_embeddings),
                embeddings_requested=bool(include and "embeddings" in include),
            )

        spec = _IncludeSpec.resolve(include, default_distances=True)
        q_filter = _qdrant_filter(where)
        outer_ids: list[list[str]] = []
        outer_docs: list[list[str]] = []
        outer_metas: list[list[dict]] = []
        outer_dists: list[list[float]] = []
        outer_embeds: list[list[list[float]]] = []
        for query_vector in query_embeddings:
            q = _as_vector_array(query_vector)
            if self._known_dimension is None:
                self._known_dimension = self._remote_dimension()
            if self._known_dimension is not None and int(q.size) != self._known_dimension:
                raise DimensionMismatchError(

View on GitHub (pinned to 06cb6987f0)

Solutions

  1. Recreate the collection: either re-ingest the data (searcher can rebuild) or call upsert() again — _ensure_remote_collection will recreate the collection on next write
  2. Or clear the stale marker so the backend treats the collection as absent (query then returns empty instead of raising)
  3. Give Qdrant a persistent volume (docker volume mount) so collections survive restarts
  4. If the palace directory was copied from another machine, expect marker/remote divergence; rebuild via the repair tooling (mempalace repair)

Example fix

# before
# Qdrant volume wiped; marker remains:
collection.query(query_embeddings=[q])  # CollectionNotInitializedError
// after
# re-ingest: first write recreates the remote collection
collection.upsert(documents=docs, ids=ids, embeddings=embs)
collection.query(query_embeddings=[q])
Defensive patterns

Strategy: fallback

Validate before calling

if not collection._remote_exists() and collection._marker_exists():
    logger.warning("marker present but remote collection missing; will re-create on next write")

Try / catch

from mempalace.backends.base import CollectionNotInitializedError
try:
    res = collection.query(query_embeddings=[q])
except CollectionNotInitializedError:
    res = QueryResult.empty(num_queries=1)  # or trigger re-ingest / repair

Prevention

When it happens

Trigger: marker_exists() is true but _remote_exists() is false: someone dropped the collection in the Qdrant dashboard, the docker volume was recreated, Qdrant restarted with ephemeral storage, or a partial backend migration left stale markers.

Common situations: docker compose down -v wiping the Qdrant volume; switching between an embedded and a remote Qdrant pointing at the same palace dir; server redeployed without persistent storage; manual cleanup that deleted collections but not the palace sidecar markers.

Related errors


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