RyanCodrai/turbovec · error · ValueError
texts, metadatas, and ids must all have the same length
Error message
texts, metadatas, and ids must all have the same length
What it means
Raised in add_texts (and aadd_texts) when texts, metadatas, and ids are supplied but their lengths differ. A length mismatch would misalign texts with their metadata and ids in the store, so it is rejected before embedding or any mutation.
Source
Thrown at turbovec-python/python/turbovec/langchain.py:282
) -> list[str]:
texts_list = list(texts)
if not texts_list:
return []
if metadatas is None:
metadatas = [{} for _ in texts_list]
else:
# Materialize once so a generator (or other one-shot iterable)
# survives the length check and the storage loop below.
metadatas = list(metadatas)
if ids is None:
ids = [str(uuid.uuid4()) for _ in texts_list]
else:
# Fresh list[str] (whatever container the caller passed),
# per-entry None -> UUID, any other non-str id -> TypeError.
# Raised here, before embedding or any store mutation.
ids = self._normalize_ids(list(ids))
if len(metadatas) != len(texts_list) or len(ids) != len(texts_list):
raise ValueError("texts, metadatas, and ids must all have the same length")
vectors = np.asarray(self._embedding.embed_documents(texts_list), dtype=np.float32)
self._check_embedded_batch(vectors, len(texts_list))
return self._store_texts_and_vectors(texts_list, vectors, metadatas, ids)
async def aadd_texts(
self,
texts: Iterable[str],
metadatas: list[dict] | None = None,
ids: list[str] | None = None,
**_: Any,
) -> list[str]:
texts_list = list(texts)
if not texts_list:
return []
if metadatas is None:
metadatas = [{} for _ in texts_list]
else:View on GitHub (pinned to ccab9f325e)
Solutions
- Pass metadatas/ids lists of exactly the same length as texts, or omit them (metadatas default to {}, ids to fresh UUIDs).
- Check the caller's data assembly — a zip/dedup step may have dropped entries.
- Catch the ValueError in ingestion code to validate batch construction.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at turbovec-python/python/turbovec/langchain.py:282 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of RyanCodrai/turbovec@ccab9f325e (2026-09-06).
Data as JSON: /api/errors/4abd093bdde4e624.
Report an issue: GitHub.