RyanCodrai/turbovec · error · ValueError
embedder returned empty vectors (dim 0) for {n_texts} texts
Error message
embedder returned empty vectors (dim 0) for {n_texts} texts What it means
Raised in _check_embedded_batch when a 2D embedder output has zero-width vectors (shape (N, 0)) for the given texts. The embedder produced empty vectors — typically a broken model, empty inputs, or a bad wrapper — which would otherwise fail opaquely inside the index kernel.
Source
Thrown at turbovec-python/python/turbovec/langchain.py:203
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(
f"embedder returned a {qvec.ndim}D query embedding; "
"expected a single 1D vector"
)
return qvec
View on GitHub (pinned to ccab9f325e)
Solutions
- Inspect the embedder's inputs and configuration; empty vectors usually indicate empty texts or an unloaded model.
- Validate embedder output shape at embed time before calling add_texts.
- Catch the ValueError to fail the ingestion step with an embedder-named message.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at turbovec-python/python/turbovec/langchain.py:203 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/cd77621ffd642aee.
Report an issue: GitHub.