RyanCodrai/turbovec · error · ValueError
embedder returned None instead of a query embedding
Error message
embedder returned None instead of a query embedding
What it means
Raised in _validate_query_embedding when the embedder's embed_query returned None instead of a vector (called from similarity_search_with_score and its async variant). Named here so the failure points at the embedder rather than surfacing as an opaque kernel error on the raw value.
Source
Thrown at turbovec-python/python/turbovec/langchain.py:213
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
# ---- Write path ---------------------------------------------------
@staticmethod
def _normalize_ids(ids: list[str]) -> list[str]:
"""Return a fresh ``list[str]`` copy of ``ids`` with per-entry
``None`` replaced by a generated UUID (matches the reference
InMemoryVectorStore and keeps None out of the JSON side-car,
where it would round-trip as the string ``"null"``).
Any other non-``str`` id raises ``TypeError``. This is aView on GitHub (pinned to ccab9f325e)
Solutions
- Fix the embedder's embed_query — it must return a numeric vector for the query string.
- Check the embedder wrapper for code paths that return None (unloaded model, API failure).
- Catch the ValueError in search code to report the broken embedder.
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at turbovec-python/python/turbovec/langchain.py:213 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/ce4619fd63d7948b.
Report an issue: GitHub.