{"record":{"id":"60d4dc916c4acbb4","repo":"BerriAI/litellm","slug":"error-raw-response-status-code-raw-response-te","errorCode":null,"errorMessage":"Error: {raw_response.status_code} {raw_response.text}","messagePattern":"Error: (.+?) (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/llms/vertex_ai/multimodal_embeddings/transformation.py","lineNumber":209,"sourceCode":"\n        if \"outputDimensionality\" in optional_params:\n            request_data[\"parameters\"] = {\"dimension\": optional_params[\"outputDimensionality\"]}\n\n        return cast(dict, request_data)\n\n    def transform_embedding_response(\n        self,\n        model: str,\n        raw_response: Response,\n        model_response: EmbeddingResponse,\n        logging_obj: LiteLLMLoggingObj,\n        api_key: str | None,\n        request_data: dict,\n        optional_params: dict,\n        litellm_params: dict,\n    ) -> EmbeddingResponse:\n        if raw_response.status_code != 200:\n            raise Exception(f\"Error: {raw_response.status_code} {raw_response.text}\")\n\n        _json_response: Final = raw_response.json()\n        if \"predictions\" not in _json_response:\n            raise InternalServerError(\n                message=f\"embedding response does not contain 'predictions', got {_json_response}\",\n                llm_provider=\"vertex_ai\",\n                model=model,\n            )\n        _predictions: Final = _json_response[\"predictions\"]\n        vertex_predictions: Final = MultimodalPredictions(predictions=_predictions)\n        model_response.data = self.transform_embedding_response_to_openai(predictions=vertex_predictions)\n        model_response.model = model\n\n        model_response.usage = self.calculate_usage(\n            request_data=cast(VertexMultimodalEmbeddingRequest, request_data),\n            vertex_predictions=vertex_predictions,\n        )\n","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/vertex_ai/multimodal_embeddings/transformation.py#L191-L227","documentation":"Thrown by the Vertex AI multimodal embeddings response transformer when the upstream HTTP status is not 200. The message embeds the raw status code and response body from Vertex AI, so the real cause (auth, quota, payload) is whatever the provider returned. It is the catch-all branch that runs before the response JSON is parsed.","triggerScenarios":"Calling litellm.embedding() with a Vertex AI multimodal embedding model and receiving any non-200 from the :predict endpoint: 401/403 from bad or expired service-account credentials, 429 from exhausted embedding quota, 400 from malformed instances (invalid image bytes, text over the limit), or 404 from a wrong model name or location.","commonSituations":"Expired or missing GOOGLE_APPLICATION_CREDENTIALS; model not enabled in the chosen vertex_location; images sent as invalid base64 or unreachable URLs; quota exceeded on a busy project; typo in the model id.","solutions":["Read the status code and body inside the message - they come verbatim from Vertex AI and name the real failure","On 401/403: refresh the service-account key and verify GOOGLE_APPLICATION_CREDENTIALS / vertex_credentials and the project","On 429: check Vertex AI quotas for the embedding model and retry with exponential backoff","On 400: verify the image is a valid base64 data URI or public URL and that input text is within model limits","Confirm the model name and that it is available in vertex_location (default us-central1)"],"exampleFix":"// before\nresp = litellm.embedding(model='vertex_ai/multimodalembedding@001', input=[{'text': 'hi'}])\n\n// after - surface the upstream status code and body Vertex AI returned\ntry:\n    resp = litellm.embedding(model='vertex_ai/multimodalembedding@001', input=[{'text': 'hi'}])\nexcept Exception as e:\n    msg = str(e)  # 'Error: 429 {...}' - parse the code and act on it\n    if ' 429 ' in msg:\n        time.sleep(30)  # quota hit - back off before retrying\n        resp = litellm.embedding(model='vertex_ai/multimodalembedding@001', input=[{'text': 'hi'}])","handlingStrategy":"try-catch","validationCode":"import base64\n\ndef valid_image_b64(image_b64: str) -> bool:\n    try:\n        base64.b64decode(image_b64, validate=True)\n        return True\n    except Exception:\n        return False\n\n# run before the call to avoid the common 400 case\nassert valid_image_b64(image_b64), 'invalid base64 image payload'","typeGuard":null,"tryCatchPattern":"try:\n    resp = litellm.embedding(model=model, input=inputs)\nexcept Exception as e:\n    # message embeds the upstream '{status_code} {body}' from Vertex AI\n    log.error('vertex multimodal embedding failed: %s', e)\n    if ' 429 ' in str(e):\n        time.sleep(30)\n        resp = litellm.embedding(model=model, input=inputs)\n    else:\n        raise","preventionTips":["Verify GCP credentials and quota before deploying","Keep image payloads within the model's documented size and count limits","Wrap calls in retry with backoff for 429 responses","Pin vertex_location to a region where the model is enabled"],"tags":["vertex-ai","embeddings","http-error","multimodal","api-response"],"backgroundTag":"http-error-response","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}