{"record":{"id":"5e0da86385478ca4","repo":"BerriAI/litellm","slug":"err-response-text-5e0da8","errorCode":null,"errorMessage":"{err.response.text}","messagePattern":"\\{err\\.response\\.text\\}","errorType":"http","errorClass":"VertexAIError","httpStatus":null,"severity":"error","filePath":"litellm/llms/vertex_ai/multimodal_embeddings/embedding_handler.py","lineNumber":175,"sourceCode":"        if client is None:\n            _params: Final = {}\n            if timeout is not None:\n                if isinstance(timeout, float) or isinstance(timeout, int):\n                    timeout = httpx.Timeout(timeout)\n                _params[\"timeout\"] = timeout\n            client = get_async_httpx_client(\n                llm_provider=litellm.LlmProviders.VERTEX_AI,\n                params={\"timeout\": timeout},\n            )\n        else:\n            client = client\n\n        try:\n            response: Final = await client.post(api_base, headers=headers, json=data)\n            response.raise_for_status()\n        except httpx.HTTPStatusError as err:\n            error_code: Final = err.response.status_code\n            raise VertexAIError(status_code=error_code, message=err.response.text)\n        except httpx.TimeoutException:\n            raise VertexAIError(status_code=408, message=\"Timeout error occurred.\")\n\n        return vertex_multimodal_embedding_handler.transform_embedding_response(\n            model=model,\n            raw_response=response,\n            model_response=model_response,\n            logging_obj=logging_obj,\n            api_key=api_key,\n            request_data=data,\n            optional_params=optional_params,\n            litellm_params=litellm_params,\n        )\n","sourceCodeStart":157,"sourceCodeEnd":189,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/vertex_ai/multimodal_embeddings/embedding_handler.py#L157-L189","documentation":"The async multimodal embedding path (litellm.aembedding with vertex_ai/multimodalembedding@001) wraps HTTP failures: httpx raise_for_status() raises HTTPStatusError, which litellm re-raises as VertexAIError carrying the upstream status code and raw response body. Unlike image generation's bare Exception, this is a typed error — inspect .status_code and .message to branch on the cause.","triggerScenarios":"await litellm.aembedding(model='vertex_ai/multimodalembedding@001', input=['a cat', 'gs://bucket/cat.png']) returning 400 (invalid instance — e.g. bad outputDimensionality, malformed base64, text over the model's token limit), 401 (expired access token), 403 (Vertex AI API not enabled / no predict permission), or 404 (model name typo like multimodalembedding@002).","commonSituations":"Forgetting to enable the Vertex AI API in the project; passing an unsupported dimensions value via map_openai_params; expired tokens after long-running processes cache credentials; gs:// URIs the service account cannot read.","solutions":["Catch VertexAIError and read .status_code and .message to identify the upstream cause","403/404: enable the multimodalembedding model and verify the model name in your region","400: validate instances — supported dimensions only, valid base64/GCS URIs, text within token limits","401: refresh credentials (re-run gcloud auth application-default login or rotate the SA key)","Verify the service account has storage.objects.get access for gs:// image inputs"],"exampleFix":"# before\nresp = await litellm.aembedding(\n    model='vertex_ai/multimodalembedding@001',\n    input=['a cat', 'gs://my-bucket/cat.png'],\n)\n\n# after\nfrom litellm.exceptions import APIError\ntry:\n    resp = await litellm.aembedding(\n        model='vertex_ai/multimodalembedding@001',\n        input=['a cat', 'gs://my-bucket/cat.png'],\n        vertex_ai_project='my-project',\n        vertex_ai_location='us-central1',\n    )\nexcept Exception as e:\n    status = getattr(e, 'status_code', None)\n    if status == 403:\n        raise RuntimeError('Enable Vertex AI API and check IAM') from e\n    raise","handlingStrategy":"try-catch","validationCode":"def valid_multimodal_instances(inputs) -> bool:\n    return all(isinstance(x, str) and x for x in inputs)\n\nassert valid_multimodal_instances(inputs), 'inputs must be non-empty text/gs:// URIs/base64 strings'","typeGuard":null,"tryCatchPattern":"try:\n    resp = await litellm.aembedding(model='vertex_ai/multimodalembedding@001', input=inputs)\nexcept Exception as e:\n    status = getattr(e, 'status_code', None)\n    if status == 400:\n        raise ValueError('invalid instance payload (dimensions/base64/token limit)') from e\n    if status in (401, 403):\n        raise RuntimeError('credentials/IAM problem — check API enablement and roles') from e\n    raise","preventionTips":["Enable the Vertex AI/multimodalembedding API and verify IAM before shipping","Validate dimensions values and base64/GCS URI formats client-side","Confirm the service account can read the gs:// objects you reference","Handle 401 by refreshing credentials in long-running processes"],"tags":["vertex-ai","multimodal-embeddings","http-error","gcp","iam"],"backgroundTag":"http-error-response","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}