{"record":{"id":"b6f0c04407494ecc","repo":"BerriAI/litellm","slug":"v1-embeddings-route-returned-none-embeddings","errorCode":null,"errorMessage":"/v1/embeddings route returned None Embeddings.","messagePattern":"/v1/embeddings route returned None Embeddings\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/llms/azure_ai/embed/handler.py","lineNumber":185,"sourceCode":"            if image_embedding_responses is None:\n                raise Exception(\"/image/embeddings route returned None Embeddings.\")\n\n        if v1_embeddings_request[\"input\"]:\n            response: Final[EmbeddingResponse] = await super().embedding(\n                model=model,\n                input=input,\n                timeout=timeout,\n                logging_obj=logging_obj,\n                model_response=model_response,\n                optional_params=optional_params,\n                api_key=api_key,\n                api_base=api_base,\n                client=client,\n                aembedding=True,\n            )\n            text_embedding_responses = response.data\n            if text_embedding_responses is None:\n                raise Exception(\"/v1/embeddings route returned None Embeddings.\")\n\n        return self._process_response(\n            image_embedding_responses=image_embedding_responses,\n            text_embedding_responses=text_embedding_responses,\n            image_embeddings_idx=image_embeddings_idx,\n            model_response=model_response,\n            input=input,\n        )\n\n    def embedding(\n        self,\n        model: str,\n        input: list,\n        timeout: float,\n        logging_obj,\n        model_response: EmbeddingResponse,\n        optional_params: dict,\n        api_key: str | None = None,","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/azure_ai/embed/handler.py#L167-L203","documentation":"Second half of the async multimodal embedding flow: after a successful /v1/embeddings (text) call, LiteLLM checks response.data and raises '/v1/embeddings route returned None Embeddings.' if the parsed data array is None. Like its image twin, the HTTP call succeeded but no vectors were extracted — usually bad input or a response-shape mismatch.","triggerScenarios":"aembedding() where the text part of the input is malformed (empty strings, None entries) so Azure returns 200 with no data; or the azure_ai response parser failing on an unexpected payload shape; text-only requests reaching this combined handler with the text list unexpectedly empty-but-truthy.","commonSituations":"Mixing image and text inputs and a filtering step leaves whitespace-only strings; upstream producer sends dicts where strings were expected; litellm/azure schema drift after preview api-version change.","solutions":["Log the input array right before the call — hunt for empty/None/non-string entries and filter them.","Inspect the raw /v1/embeddings response for one input via curl to see whether data is absent upstream or lost in parsing.","If raw data exists but litellm yields None, upgrade litellm.","Send text and images as separate, well-formed lists rather than relying on the combined route to sort them."],"exampleFix":"# before\nresp = await litellm.aembedding(model='azure_ai/mm-embed', input=texts_and_images)\n\n# after\ntexts = [t for t in inputs if isinstance(t, str) and t.strip()]\nimages = [i for i in inputs if is_image(i)]\nresp = await litellm.aembedding(model='azure_ai/mm-embed', input=texts + images)","handlingStrategy":"validation","validationCode":"def clean_text_inputs(inputs: list) -> list[str]:\n    cleaned = [t for t in inputs if isinstance(t, str) and t.strip()]\n    if not cleaned:\n        raise ValueError('no non-empty text inputs for /v1/embeddings')\n    return cleaned","typeGuard":null,"tryCatchPattern":"try:\n    resp = await litellm.aembedding(model='azure_ai/mm-embed', input=clean_text_inputs(texts))\nexcept Exception as e:\n    if '/v1/embeddings route returned None' in str(e):\n        logger.error('empty embedding data for inputs=%r', texts)\n        return fallback_embedding()  # or skip batch\n    raise","preventionTips":["Filter empty/whitespace chunks in the ingestion pipeline, with a test.","Send text and images as cleanly separated lists to the combined route.","Alert whenever data comes back None — it indicates upstream or version drift, not normal behavior."],"tags":["azure","embeddings","empty-response","data-validation","async"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}