{"record":{"id":"294253ee761cb0d6","repo":"BerriAI/litellm","slug":"no-embedding-data-found-in-response-response","errorCode":null,"errorMessage":"No embedding data found in response: {response}","messagePattern":"No embedding data found in response: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/bedrock/embed/amazon_titan_v2_transformation.py","lineNumber":101,"sourceCode":"        for index, response in enumerate(response_list):\n            _parsed_response = AmazonTitanV2EmbeddingResponse(**response)\n\n            # According to AWS docs, embeddingsByType is always present\n            # If binary was requested (encoding_format=\"base64\"), use binary data\n            # Otherwise, use float data from embeddingsByType or fallback to embedding field\n            embedding_data: list[float] | list[int]\n\n            if \"embeddingsByType\" in _parsed_response and \"binary\" in _parsed_response[\"embeddingsByType\"]:\n                # Use binary data if available (for encoding_format=\"base64\")\n                embedding_data = _parsed_response[\"embeddingsByType\"][\"binary\"]\n            elif \"embeddingsByType\" in _parsed_response and \"float\" in _parsed_response[\"embeddingsByType\"]:\n                # Use float data from embeddingsByType\n                embedding_data = _parsed_response[\"embeddingsByType\"][\"float\"]\n            elif \"embedding\" in _parsed_response:\n                # Fallback to legacy embedding field\n                embedding_data = _parsed_response[\"embedding\"]\n            else:\n                raise ValueError(f\"No embedding data found in response: {response}\")\n\n            transformed_responses.append(\n                Embedding(\n                    embedding=embedding_data,\n                    index=index,\n                    object=\"embedding\",\n                )\n            )\n            total_prompt_tokens += _parsed_response[\"inputTextTokenCount\"]\n\n        usage: Final = Usage(\n            prompt_tokens=total_prompt_tokens,\n            completion_tokens=0,\n            total_tokens=total_prompt_tokens,\n        )\n        return EmbeddingResponse(model=model, usage=usage, data=transformed_responses)\n","sourceCodeStart":83,"sourceCodeEnd":118,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/bedrock/embed/amazon_titan_v2_transformation.py#L83-L118","documentation":"After a successful Amazon Titan Embeddings v2 call, the response must contain embedding data under 'embeddingsByType.binary', 'embeddingsByType.float', or the legacy 'embedding' key. If none is present, LiteLLM cannot build the Embedding result and raises ValueError including the raw response.","triggerScenarios":"AWS changes or regional variants returning a different response schema; requesting an embeddingType combination Titan v2 rejects so the response omits all data fields; or a proxy/gateway mangling the JSON body.","commonSituations":"Version drift between LiteLLM's Titan v2 parser and the AWS API, or downstream middlewares (debug proxies, payload filters) stripping response fields.","solutions":["Inspect the response embedded in the error message to see which keys AWS actually returned","Upgrade LiteLLM to the latest version so the parser matches the current Titan v2 schema","Remove any intermediate proxies that rewrite the response body"],"exampleFix":"# before: relying on default response shape\nlitellm.embedding(model='bedrock/amazon.titan-embed-text-v2:0', input=['hi'])\n\n# after: pin embedding types the parser understands\nlitellm.embedding(\n    model='bedrock/amazon.titan-embed-text-v2:0',\n    input=['hi'],\n    embeddingTypes=['float'],\n)","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    resp = litellm.embedding(model=\"bedrock/amazon.titan-embed-text-v2:0\", input=texts, embeddingTypes=[\"float\"])\nexcept ValueError as e:\n    if \"No embedding data found in response\" in str(e):\n        # schema drift: pin/upgrade litellm, inspect raw response in the message\n        raise RuntimeError(f\"Titan v2 response schema changed: {e}\") from e\n    raise","preventionTips":["Pin a known-good LiteLLM version and test after upgrades that touch Bedrock transforms","Explicitly request embeddingTypes=['float'] so the expected response shape is deterministic"],"tags":["bedrock","titan","embedding","response-parsing"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}