BerriAI/litellm · error · ValueError
embedContent response missing 'embedding' field: {response_j
Error message
embedContent response missing 'embedding' field: {response_json} What it means
Gemini embedContent response guard: the parsed response JSON lacks the required 'embedding' field, so no vector can be extracted; the full response JSON is echoed to diagnose the unexpected provider payload.
Source
Thrown at litellm/llms/vertex_ai/gemini_embeddings/batch_embed_content_transformation.py:425
response_json: dict,
resolved_files: Mapping[str, Mapping[str, str]] | None = None,
) -> EmbeddingResponse:
"""
Process Gemini embedContent response (single embedding for multimodal input).
Args:
input: Original input
model_response: EmbeddingResponse to populate
model: Model name
response_json: Raw JSON response from embedContent endpoint
resolved_files: Mapping of file references (files/abc) to {mime_type, uri},
used to bill resolved image references at the per-image rate
Returns:
EmbeddingResponse with single embedding
"""
if "embedding" not in response_json:
raise ValueError(f"embedContent response missing 'embedding' field: {response_json}")
embedding_data: Final = response_json["embedding"]
openai_embedding: Final = Embedding(
embedding=embedding_data["values"],
index=0,
object="embedding",
)
model_response.data = [openai_embedding]
model_response.model = model
model_response.usage = _usage_from_embed_content_response(
input=input,
model=model,
raw_usage_metadata=response_json.get("usageMetadata"),
resolved_files=resolved_files or {},
)
View on GitHub (pinned to 77b7c6c40c)
Solutions
- Inspect the raw response_json in the error for an upstream error message or a changed response schema.
- Retry the request; if it persists, verify the model name and that the embedContent endpoint returned a successful status.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at litellm/llms/vertex_ai/gemini_embeddings/batch_embed_content_transformation.py:425 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/7547ec979161289c.
Report an issue: GitHub.