MemPalace/mempalace · error · ValueError

embeddings length {len(embeddings)} does not match ids lengt

Error message

embeddings length {len(embeddings)} does not match ids length {len(ids)}

What it means

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

Source

Thrown at mempalace/backends/milvus.py:497

    def _prepare_rows(
        self,
        *,
        documents: list[str],
        ids: list[str],
        metadatas: Optional[list[dict]],
        embeddings: list[list[float]],
    ) -> tuple[list[dict], int]:
        if len(documents) != len(ids):
            raise ValueError(
                f"documents length {len(documents)} does not match ids length {len(ids)}"
            )
        if metadatas is not None and len(metadatas) != len(ids):
            raise ValueError(
                f"metadatas length {len(metadatas)} does not match ids length {len(ids)}"
            )
        if len(embeddings) != len(ids):
            raise ValueError(
                f"embeddings length {len(embeddings)} does not match ids length {len(ids)}"
            )
        vectors, dimension = _normalize_vectors(embeddings)
        metadatas = metadatas or [{} for _ in ids]
        rows = []
        for idx, (doc_id, document, metadata, vector) in enumerate(
            zip(ids, documents, metadatas, vectors)
        ):
            if not isinstance(doc_id, str) or not doc_id:
                raise ValueError(f"row {idx}: id must be a non-empty string")
            doc_id_bytes = _utf8_len(doc_id)
            if doc_id_bytes > DRAWER_ID_MAX_LENGTH:
                raise ValueError(
                    f"row {idx}: id byte length {doc_id_bytes} exceeds {DRAWER_ID_MAX_LENGTH}"
                )
            document = _clean_text(document)
            document_bytes = _utf8_len(document)
            if document_bytes > DOCUMENT_MAX_LENGTH:

View on GitHub (pinned to 06cb6987f0)

Solutions

  1. Pass one embedding vector per id; align the embeddings list with the ids list

When it happens

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

Common situations: Embeddings were computed for a subset of ids, or ids were filtered after embedding.


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