BerriAI/litellm · error · HTTPException

target_model_names must be a comma-separated string or list

Error message

target_model_names must be a comma-separated string or list of model names

What it means

Type guard on the optional target_model_names request field: it was supplied but is neither a comma-separated string nor a list, so the multi-model vector-store routing list cannot be built. JSON payloads should pass an array or a 'a,b,c' string.

Source

Thrown at litellm/proxy/vector_store_endpoints/endpoints.py:218

        user_model,
        user_request_timeout,
        user_temperature,
        version,
    )

    data: Final = await _read_request_body(request=request)

    # Check for target_model_names parameter
    target_model_names: Final = data.pop("target_model_names", None)

    if target_model_names:
        # Use managed vector stores for multi-model support
        if isinstance(target_model_names, str):
            target_model_names_list = [m.strip() for m in target_model_names.split(",")]
        elif isinstance(target_model_names, list):
            target_model_names_list = target_model_names
        else:
            raise HTTPException(
                status_code=400,
                detail="target_model_names must be a comma-separated string or list of model names",
            )

        # Get managed vector stores hook
        managed_vector_stores: Final[Any] = proxy_logging_obj.get_proxy_hook("managed_vector_stores")
        if managed_vector_stores is None:
            raise HTTPException(
                status_code=500,
                detail="Managed vector stores not configured. Please ensure the proxy is initialized with database support.",
            )

        if llm_router is None:
            raise HTTPException(
                status_code=500,
                detail="LLM Router not initialized. Ensure models are added to proxy.",
            )

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Pass target_model_names as a comma-separated string or a JSON list of model names.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/vector_store_endpoints/endpoints.py:218 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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