BerriAI/litellm · error · Exception
/image/embeddings route returned None Embeddings.
Error message
/image/embeddings route returned None Embeddings.
What it means
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.
Source
Thrown at litellm/llms/azure_ai/embed/handler.py:168
image_embedding_responses: list | None = None
text_embedding_responses: list | None = None
if image_embeddings_request["input"]:
image_response: Final = await self.async_image_embedding(
model=model,
data=image_embeddings_request,
timeout=timeout,
logging_obj=logging_obj,
model_response=model_response,
optional_params=optional_params,
api_key=api_key,
api_base=api_base,
client=client,
)
image_embedding_responses = image_response.data
if image_embedding_responses is None:
raise Exception("/image/embeddings route returned None Embeddings.")
if v1_embeddings_request["input"]:
response: Final[EmbeddingResponse] = await super().embedding(
model=model,
input=input,
timeout=timeout,
logging_obj=logging_obj,
model_response=model_response,
optional_params=optional_params,
api_key=api_key,
api_base=api_base,
client=client,
aembedding=True,
)
text_embedding_responses = response.data
if text_embedding_responses is None:
raise Exception("/v1/embeddings route returned None Embeddings.")
View on GitHub (pinned to 6c2dcb801b)
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.
Example fix
# before litellm.aembedding(model='azure_ai/mm-embed', input=['data:image/png;base64,' + b64]) # after import base64, re raw = re.sub(r'^data:image/\w+;base64,', '', data_uri) litellm.aembedding(model='azure_ai/mm-embed', input=[raw])
Defensive patterns
Strategy: validation
Validate before calling
import base64, re
def clean_image_b64(img: str) -> str:
raw = re.sub(r'^data:image/[a-zA-Z]+;base64,', '', img).replace('\n', '')
base64.b64decode(raw, validate=True) # raises on bad input before the API call
return raw Try / catch
try:
resp = await litellm.aembedding(model='azure_ai/mm-embed', input=[clean_image_b64(i) for i in imgs])
except Exception as e:
if 'returned None Embeddings' in str(e):
drop_and_alert_bad_inputs(imgs) # keep pipeline alive, flag offending batch
raise
raise Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- /v1/embeddings route returned None Embeddings.
- api_base is None. Please set AZURE_AI_API_BASE or dynamicall
- Failed to parse raw Azure embedding response: {json_error}
- embedding_response is not an instance of EmbeddingResponse
- api_key is None. Please set AZURE_AI_API_KEY or dynamically
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/4c390e80c51aeab6.
Report an issue: GitHub.