RyanCodrai/turbovec · error · ValueError
embedder returned {vectors.shape[0]} vectors for {n_texts} t
Error message
embedder returned {vectors.shape[0]} vectors for {n_texts} texts What it means
Raised in _check_embedded_batch when a 2D embedder output has a different row count than the number of input texts — a misbehaving embedder returned fewer (or more) vectors than texts. Without this check the mismatch surfaces downstream as an id-count error or IndexError during dedup that never names the embedder as the cause.
Source
Thrown at turbovec-python/python/turbovec/langchain.py:198
return lambda sim: (sim + 1.0) / 2.0
# ---- Embedder-output validation -----------------------------------
@staticmethod
def _check_embedded_batch(vectors: np.ndarray, n_texts: int) -> None:
"""Validate the shape of an embedder's document-batch output.
Only 2D outputs are inspected here — any other ndim falls through
to ``_store_texts_and_vectors``, whose existing guard names the bad
dimensionality directly. Without the row-count check, a misbehaving
embedder that returns fewer vectors than texts surfaces downstream
as an id-count mismatch (or an IndexError during intra-batch
dedup) that never names the embedder as the cause.
"""
if vectors.ndim != 2:
return
if vectors.shape[0] != n_texts:
raise ValueError(
f"embedder returned {vectors.shape[0]} vectors for "
f"{n_texts} texts"
)
if vectors.shape[1] == 0:
raise ValueError(
f"embedder returned empty vectors (dim 0) for {n_texts} texts"
)
def _validate_query_embedding(self, embedded: Any) -> np.ndarray:
"""Coerce an embedder's query output to a 1D float32 vector,
rejecting None and wrong-rank outputs with an error that names
the embedder (the raw values otherwise surface as opaque errors
from the index kernel)."""
if embedded is None:
raise ValueError("embedder returned None instead of a query embedding")
qvec = np.asarray(embedded, dtype=np.float32)
if qvec.ndim != 1:
raise ValueError(View on GitHub (pinned to ccab9f325e)
Solutions
- Fix or replace the embedder — a conforming Embeddings.embed_documents returns exactly one vector per text.
- Check for batch-size truncation in wrapper embedders (e.g. API limits silently dropping rows).
- Catch the ValueError in ingestion code to flag the embedder as the failing component.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at turbovec-python/python/turbovec/langchain.py:198 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/98854f850aee0fb4.
Report an issue: GitHub.