{"record":{"id":"ce4619fd63d7948b","repo":"RyanCodrai/turbovec","slug":"embedder-returned-none-instead-of-a-query-embeddin","errorCode":null,"errorMessage":"embedder returned None instead of a query embedding","messagePattern":"embedder returned None instead of a query embedding","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"turbovec-python/python/turbovec/langchain.py","lineNumber":213,"sourceCode":"        if vectors.ndim != 2:\n            return\n        if vectors.shape[0] != n_texts:\n            raise ValueError(\n                f\"embedder returned {vectors.shape[0]} vectors for \"\n                f\"{n_texts} texts\"\n            )\n        if vectors.shape[1] == 0:\n            raise ValueError(\n                f\"embedder returned empty vectors (dim 0) for {n_texts} texts\"\n            )\n\n    def _validate_query_embedding(self, embedded: Any) -> np.ndarray:\n        \"\"\"Coerce an embedder's query output to a 1D float32 vector,\n        rejecting None and wrong-rank outputs with an error that names\n        the embedder (the raw values otherwise surface as opaque errors\n        from the index kernel).\"\"\"\n        if embedded is None:\n            raise ValueError(\"embedder returned None instead of a query embedding\")\n        qvec = np.asarray(embedded, dtype=np.float32)\n        if qvec.ndim != 1:\n            raise ValueError(\n                f\"embedder returned a {qvec.ndim}D query embedding; \"\n                \"expected a single 1D vector\"\n            )\n        return qvec\n\n    # ---- Write path ---------------------------------------------------\n\n    @staticmethod\n    def _normalize_ids(ids: list[str]) -> list[str]:\n        \"\"\"Return a fresh ``list[str]`` copy of ``ids`` with per-entry\n        ``None`` replaced by a generated UUID (matches the reference\n        InMemoryVectorStore and keeps None out of the JSON side-car,\n        where it would round-trip as the string ``\"null\"``).\n\n        Any other non-``str`` id raises ``TypeError``. This is a","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/RyanCodrai/turbovec/blob/ccab9f325e6ce2a270a87daf01ae4e443bcf2d49/turbovec-python/python/turbovec/langchain.py#L195-L231","documentation":"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.","triggerScenarios":"Thrown at turbovec-python/python/turbovec/langchain.py:213 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ccab9f325e6ce2a270a87daf01ae4e443bcf2d49","analyzedAt":"2026-09-06T08:39:18.516Z","contentChangedAt":"2026-09-06T08:39:18.516Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}