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 {dimension}

What it means

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

Source

Thrown at mempalace/backends/milvus.py:398

            name = field.get("name") or field.get("field_name")
            if name != FIELD_VECTOR:
                continue
            params = field.get("params") or field.get("type_params") or {}
            dim = field.get("dim") or params.get("dim")
            try:
                return int(dim)
            except (TypeError, ValueError):
                return None
        return None

    def _ensure_remote_collection(self, dimension: int) -> None:
        if dimension <= 0:
            raise ValueError("embedding dimension must be positive")
        with self._lock:
            self._ensure_open()
            if self._known_dimension is not None:
                if self._known_dimension != dimension:
                    raise DimensionMismatchError(
                        f"milvus collection {self._collection_name!r} expects "
                        f"embedding dimension {self._known_dimension}, got {dimension}"
                    )
                return
            if not self._remote_exists():
                self._backend._create_remote_collection(
                    self._client,
                    self._remote_collection,
                    dimension,
                    consistency_level=self._config.consistency_level,
                )
                self._backend._load_remote_collection(self._client, self._remote_collection)
                self._known_dimension = dimension
                self._known_native_lexical = True
                self._backend._write_marker(self._palace, self._config)
                return
            remote_dim = self._remote_dimension()
            if remote_dim is not None and remote_dim != dimension:

View on GitHub (pinned to 06cb6987f0)

Solutions

  1. Re-embed the palace with the matching embedding model, or recreate the milvus collection with the expected dimension
  2. Verify the configured MEMPALACE_EMBEDDING_MODEL matches the model used to build the collection

When it happens

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

Common situations: Embedding model was changed after the collection was created, or the wrong model is configured for this palace.


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