MemPalace/mempalace · error · DimensionMismatchError

milvus collection {self._collection_name!r} expects embeddin

Error message

milvus collection {self._collection_name!r} expects embedding dimension {self._known_dimension}, got {int(q.size)}

What it means

Error "milvus collection {self._collection_name!r} expects embedding dimension {self._known_dimension}, got {int(q.size)}" thrown in MemPalace/mempalace.

Source

Thrown at mempalace/backends/milvus.py:647

                num_queries=len(query_embeddings),
                embeddings_requested=bool(include and "embeddings" in include),
            )
        spec = _IncludeSpec.resolve(include, default_distances=True)
        output_fields = self._output_fields(spec)
        filter_expr = _combine_filter(
            translate_where(where), translate_where_document(where_document)
        )
        outer_ids: list[list[str]] = []
        outer_docs: list[list[str]] = []
        outer_metas: list[list[dict]] = []
        outer_dists: list[list[float]] = []
        outer_embeddings: 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(
                    f"milvus collection {self._collection_name!r} expects "
                    f"embedding dimension {self._known_dimension}, got {int(q.size)}"
                )
            kwargs = {
                "collection_name": self._remote_collection,
                "data": [q.astype(float).tolist()],
                "limit": int(n_results),
                "output_fields": output_fields,
                "anns_field": FIELD_VECTOR,
                "search_params": {"metric_type": "COSINE"},
                "consistency_level": self._config.consistency_level,
            }
            if filter_expr:
                kwargs["filter"] = filter_expr
            raw = self._client.search(**kwargs)
            hits = raw[0] if raw else []
            rows = [self._row_from_search_hit(hit) for hit in hits]
            outer_ids.append([row[FIELD_ID] for row in rows])

View on GitHub (pinned to 06cb6987f0)

Solutions

  1. Re-embed the palace with the matching model or recreate the collection with the expected dimension

When it happens

Trigger: Thrown at mempalace/backends/milvus.py:647 when the library encounters an invalid state.

Common situations: Query embedding dimension does not match the collection's stored dimension after a model swap.


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