BerriAI/litellm · error · ValueError

Unsupported Vertex AI request route: {request_route}

Error message

Unsupported Vertex AI request route: {request_route}

What it means

Vertex AI fine-tuning URL router sentinel: the caller-supplied request_route does not match any known route pattern (tuningJobs, generateContent, predict, batchPredictionJobs, countTokens, cachedContents), so no URL can be built.

Source

Thrown at litellm/llms/vertex_ai/fine_tuning/handler.py:329

        elif "/tuningJobs/" in request_route and "cancel" in request_route:
            url = f"{base_url}/v1/projects/{vertex_project}/locations/{vertex_location}/tuningJobs{request_route}"
        elif (
            "generateContent" in request_route
            or "predict" in request_route
            or "/batchPredictionJobs" in request_route
            or "countTokens" in request_route
        ):
            url = f"{base_url}/v1/projects/{vertex_project}/locations/{vertex_location}{request_route}"
        elif "cachedContents" in request_route:
            _model: Final = request_data.get("model")
            if _model is not None and "/publishers/google/models/" not in _model:
                request_data["model"] = (
                    f"projects/{vertex_project}/locations/{vertex_location}/publishers/google/models/{_model}"
                )

            url = f"{base_url}/v1beta1/projects/{vertex_project}/locations/{vertex_location}{request_route}"
        else:
            raise ValueError(f"Unsupported Vertex AI request route: {request_route}")
        if self.async_handler is None:
            raise ValueError("VertexAI Fine Tuning - async_handler is not initialized")

        response: Final = await self.async_handler.post(
            headers=headers,
            url=url,
            json=request_data,
        )

        if response.status_code != 200:
            raise Exception(
                f"Error creating fine tuning job. Status code: {response.status_code}. Response: {response.text}"
            )

        response_json: Final = response.json()
        return response_json

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Use a supported fine-tuning request route for Vertex AI.
  2. Check the job operation (create/cancel/get/list) against supported routes.

Example fix

# verify the fine_tuning call maps to a supported route.
Defensive patterns

Strategy: validation

When it happens

Trigger: Triggered when an unsupported request route is passed to the Vertex AI fine tuning handler.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/10723314a6c85bb5. Report an issue: GitHub.