MemPalace/mempalace · error · ValueError

{label} length {len(value)} does not match ids length {n}

Error message

{label} length {len(value)} does not match ids length {n}

What it means

Error "{label} length {len(value)} does not match ids length {n}" thrown in MemPalace/mempalace.

Source

Thrown at mempalace/backends/milvus.py:576

            embeddings=embeddings,
        )
        if not rows:
            return
        self._ensure_remote_collection(dimension)
        self._client.upsert(collection_name=self._remote_collection, data=rows)
        self._backend._write_marker(self._palace, self._config)

    def update(self, *, ids, documents=None, metadatas=None, embeddings=None):
        if documents is None and metadatas is None and embeddings is None:
            raise ValueError("update requires at least one of documents, metadatas, embeddings")
        n = len(ids)
        for label, value in (
            ("documents", documents),
            ("metadatas", metadatas),
            ("embeddings", embeddings),
        ):
            if value is not None and len(value) != n:
                raise ValueError(f"{label} length {len(value)} does not match ids length {n}")
        existing = self.get(ids=list(ids), include=["documents", "metadatas", "embeddings"])
        by_id = {
            rid: (existing.documents[i], existing.metadatas[i], existing.embeddings[i])
            for i, rid in enumerate(existing.ids)
            if existing.embeddings is not None
        }
        out_ids = []
        out_docs = []
        out_metas = []
        out_embeddings = []
        for idx, doc_id in enumerate(ids):
            if doc_id not in by_id:
                continue
            prev_doc, prev_meta, prev_embedding = by_id[doc_id]
            out_ids.append(doc_id)
            out_docs.append(documents[idx] if documents is not None else prev_doc)
            meta = dict(prev_meta or {})
            if metadatas is not None:

View on GitHub (pinned to 06cb6987f0)

Solutions

  1. Align the length of the supplied list with the ids list before calling update

When it happens

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

Common situations: Per-id field list length drifted from the ids list length.


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