{"record":{"id":"4c390e80c51aeab6","repo":"BerriAI/litellm","slug":"image-embeddings-route-returned-none-embeddings","errorCode":null,"errorMessage":"/image/embeddings route returned None Embeddings.","messagePattern":"/image/embeddings route returned None Embeddings\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/llms/azure_ai/embed/handler.py","lineNumber":168,"sourceCode":"        image_embedding_responses: list | None = None\n        text_embedding_responses: list | None = None\n\n        if image_embeddings_request[\"input\"]:\n            image_response: Final = await self.async_image_embedding(\n                model=model,\n                data=image_embeddings_request,\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            )\n\n            image_embedding_responses = image_response.data\n            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","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/azure_ai/embed/handler.py#L150-L186","documentation":"In the async Azure AI multimodal embedding flow, after the /images/embeddings call succeeds, LiteLLM asserts that the response's data array is populated. If response.data is None it raises a plain Exception '/image/embeddings route returned None Embeddings.' — meaning the HTTP call succeeded but the parsed EmbeddingResponse carries no vectors.","triggerScenarios":"aembedding() with images in input where Azure returns 200 but an empty/None data field: malformed base64 image, image format the model can't embed, or an API/schema change making litellm's parser miss the field. HTTP-level failures raise earlier, so this specifically means empty payload.","commonSituations":"Images encoded with data-URI prefixes ('data:image/png;base64,') not stripped; empty-string or zero-byte images after a bad decode step upstream; mismatch between deployed model (text-only) sent image input; litellm version lagging a response schema change on Azure.","solutions":["Log and inspect the raw Azure response for one failing input — confirm whether data is truly absent or the shape differs.","Sanitize image inputs: pure base64, valid JPEG/PNG bytes, strip data-URI prefixes before sending.","Verify the deployment is actually an image-embedding model (e.g. a multimodal embedder) and not a text embedder silently ignoring images.","If the raw response contains vectors but litellm returns None, update litellm — likely a parser fix."],"exampleFix":"# before\nlitellm.aembedding(model='azure_ai/mm-embed', input=['data:image/png;base64,' + b64])\n\n# after\nimport base64, re\nraw = re.sub(r'^data:image/\\w+;base64,', '', data_uri)\nlitellm.aembedding(model='azure_ai/mm-embed', input=[raw])","handlingStrategy":"validation","validationCode":"import base64, re\n\ndef clean_image_b64(img: str) -> str:\n    raw = re.sub(r'^data:image/[a-zA-Z]+;base64,', '', img).replace('\\n', '')\n    base64.b64decode(raw, validate=True)  # raises on bad input before the API call\n    return raw","typeGuard":null,"tryCatchPattern":"try:\n    resp = await litellm.aembedding(model='azure_ai/mm-embed', input=[clean_image_b64(i) for i in imgs])\nexcept Exception as e:\n    if 'returned None Embeddings' in str(e):\n        drop_and_alert_bad_inputs(imgs)  # keep pipeline alive, flag offending batch\n        raise\n    raise","preventionTips":["Validate base64 and strip data-URI prefixes before sending images.","Confirm the deployment is multimodal/image-capable before enabling the image route.","Keep litellm current so response-shape changes on Azure don't surface as None data."],"tags":["azure","embeddings","image","empty-response","data-validation"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}