{"record":{"id":"0fb6038ff1948d33","repo":"BerriAI/litellm","slug":"invalid-vertex-location-format-0fb603","errorCode":null,"errorMessage":"Invalid vertex_location format","messagePattern":"Invalid vertex_location format","errorType":"validation","errorClass":"ValueError","httpStatus":500,"severity":"error","filePath":"litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py","lineNumber":1493,"sourceCode":"        return get_vertex_base_url(vertex_location)\n\n    @staticmethod\n    def update_base_target_url_with_credential_location(base_target_url: str, vertex_location: str | None) -> str:\n        return get_vertex_base_url(vertex_location)\n\n\ndef get_vertex_base_url(vertex_location: str | None) -> str:\n    \"\"\"\n    Base URL for Vertex AI pass-through (trailing slash for URL joining).\n\n    Keep location rules aligned with ``litellm.llms.vertex_ai.common_utils.get_vertex_base_url``.\n    \"\"\"\n    if vertex_location == \"global\":\n        return \"https://aiplatform.googleapis.com/\"\n    if vertex_location is None:\n        raise ValueError(\"vertex_location is required\")\n    if not re.match(r\"^[a-z][a-z0-9-]*$\", vertex_location):\n        raise ValueError(\"Invalid vertex_location format\")\n    if \"-\" not in vertex_location:\n        return f\"https://aiplatform.{vertex_location}.rep.googleapis.com/\"\n    return f\"https://{vertex_location}-aiplatform.googleapis.com/\"\n\n\ndef get_vertex_ai_allowed_incoming_headers(request: Request) -> dict:\n    \"\"\"\n    Extract only the allowed headers from incoming request for Vertex AI pass-through.\n\n    Uses an allowlist approach for security - only forwards headers we explicitly trust.\n    This prevents accidentally forwarding sensitive headers like the LiteLLM auth token.\n\n    Args:\n        request: The FastAPI request object\n\n    Returns:\n        dict: Headers dictionary with only allowed headers\n    \"\"\"","sourceCodeStart":1475,"sourceCodeEnd":1511,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py#L1475-L1511","documentation":"Raised by get_vertex_base_url when the supplied vertex_location string does not match a recognized Vertex region or 'global'; the location is used verbatim in the aiplatform hostname, so malformed values would produce an invalid URL.","triggerScenarios":"Thrown at litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py:1493 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a valid GCP region format for vertex_location, e.g. us-central1 or europe-west4.","Remove any scheme or path from the location value."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}