{"record":{"id":"cc781e0059db9954","repo":"BerriAI/litellm","slug":"unable-to-get-vertex-url-endpoint-for-mode-mode","errorCode":null,"errorMessage":"Unable to get vertex url/endpoint for mode: {mode}","messagePattern":"Unable to get vertex url/endpoint for mode: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/vertex_ai/common_utils.py","lineNumber":446,"sourceCode":"            vertex_project=vertex_project,\n            vertex_location=vertex_location,\n            vertex_api_version=vertex_api_version,\n        )\n    elif mode == \"image_generation\":\n        endpoint = \"predict\"\n        base_url = get_vertex_base_url(vertex_location)\n        if model.isdigit():\n            # Numeric model -> custom endpoint\n            url = f\"{base_url}/{vertex_api_version}/projects/{vertex_project}/locations/{vertex_location}/endpoints/{model}:{endpoint}\"\n        else:\n            # Regular model -> publisher model\n            url = f\"{base_url}/v1/projects/{vertex_project}/locations/{vertex_location}/publishers/google/models/{model}:{endpoint}\"\n    elif mode == \"count_tokens\":\n        endpoint = \"countTokens\"\n        base_url = get_vertex_base_url(vertex_location)\n        url = f\"{base_url}/{vertex_api_version}/projects/{vertex_project}/locations/{vertex_location}/publishers/google/models/{model}:{endpoint}\"\n    if not url or not endpoint:\n        raise ValueError(f\"Unable to get vertex url/endpoint for mode: {mode}\")\n    return url, endpoint\n\n\ndef _get_gemini_url(\n    mode: all_gemini_url_modes,\n    model: str,\n    stream: bool | None,\n) -> tuple[str, str]:\n    \"\"\"Build the Gemini API URL for the given mode.\n\n    The API key is NOT included in the URL. Callers must pass it via the\n    ``x-goog-api-key`` header instead to avoid leaking credentials in\n    error tracebacks.\n    \"\"\"\n    from litellm.llms.vertex_ai.gemini.vertex_and_google_ai_studio_gemini import (\n        VertexGeminiConfig,\n    )\n","sourceCodeStart":428,"sourceCodeEnd":464,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/vertex_ai/common_utils.py#L428-L464","documentation":"Vertex URL mapper sentinel: get_url for the given mode (e.g. an unsupported operation type) has no URL-building branch, so it raises to signal the mode/path combination is unhandled rather than returning a bogus endpoint.","triggerScenarios":"Triggered when no Vertex AI URL/endpoint can be constructed for the requested mode.","commonSituations":"See trigger scenarios.","solutions":["Use a supported mode for Vertex AI (chat, embedding, image_generation, etc.).","Check the call type and provider route configuration."],"exampleFix":"# verify the litellm call function matches a supported vertex mode.","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"}