{"record":{"id":"af6fb6341ff958d7","repo":"BerriAI/litellm","slug":"timeout-error-occurred-af6fb6","errorCode":null,"errorMessage":"Timeout error occurred.","messagePattern":"Timeout error occurred\\.","errorType":"exception","errorClass":"VertexAIError","httpStatus":408,"severity":"error","filePath":"litellm/llms/vertex_ai/multimodal_embeddings/embedding_handler.py","lineNumber":177,"sourceCode":"            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":159,"sourceCodeEnd":189,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/vertex_ai/multimodal_embeddings/embedding_handler.py#L159-L189","documentation":"In the async multimodal embedding handler, an httpx.TimeoutException (connect/read/write/pool timeout) is converted into VertexAIError with status 408 and the fixed message 'Timeout error occurred.' The timeout budget comes from the timeout argument (default 300s in the embedding entry point) or the client you inject. The fixed message means the caller cannot tell which phase timed out — only that the request exceeded the budget.","triggerScenarios":"await litellm.aembedding(model='vertex_ai/multimodalembedding@001', input=[..., 'gs://bucket/huge-video.mp4']) where embedding a large video exceeds the default 300s; passing timeout=5 with sizeable media inputs; slow or throttled egress to {region}-aiplatform.googleapis.com; connection pool starvation under high concurrency.","commonSituations":"Embedding long videos or many instances in one request; aggressive custom timeouts copied from chat-completion code; corporate proxies adding latency; serverless environments with tight networking.","solutions":["Raise the budget: pass timeout=600 to the aembedding call","Shrink the workload: split inputs into batches and embed fewer/smaller media items per request","Retry once with backoff — transient network stalls often clear","Verify network path to {region}-aiplatform.googleapis.com and any proxy configuration"],"exampleFix":"# before\nresp = await litellm.aembedding(\n    model='vertex_ai/multimodalembedding@001',\n    input=['gs://bucket/long-video.mp4'],\n    timeout=10,  # too small for video\n)\n\n# after\nresp = await litellm.aembedding(\n    model='vertex_ai/multimodalembedding@001',\n    input=['gs://bucket/long-video.mp4'],\n    timeout=600,\n)","handlingStrategy":"retry","validationCode":"REQUEST_TIMEOUT = 600  # size budget to video/media size before calling\nassert estimated_seconds(inputs) < REQUEST_TIMEOUT, 'split media into smaller batches'","typeGuard":null,"tryCatchPattern":"for attempt in range(3):\n    try:\n        resp = await litellm.aembedding(\n            model='vertex_ai/multimodalembedding@001',\n            input=inputs,\n            timeout=600,\n        )\n        break\n    except Exception as e:\n        if getattr(e, 'status_code', None) == 408 or 'Timeout' in str(e):\n            await asyncio.sleep(2 ** attempt)\n            continue\n        raise","preventionTips":["Set timeout proportional to media size (videos need minutes, not seconds)","Batch large inputs instead of sending many media URIs at once","Retry once on timeout — transient stalls are common","Monitor egress latency to {region}-aiplatform.googleapis.com"],"tags":["vertex-ai","multimodal-embeddings","timeout","async","network"],"backgroundTag":"request-timeout","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}