BerriAI/litellm · error · HTTPException

Either model_names or model_ids must be provided and non-emp

Error message

Either model_names or model_ids must be provided and non-empty

What it means

Input guard on access-group creation: neither model_names nor model_ids was supplied (or both were empty lists). A group with no members cannot be applied to any deployment, so the request is rejected up front.

Source

Thrown at litellm/proxy/management_endpoints/model_access_group_management_endpoints.py:382

        llm_router,
        prisma_client,
    )

    verbose_proxy_logger.debug("Creating access group: %s with models: %s", data.access_group, data.model_names)

    # Validation: Check if access_group is provided
    if not data.access_group or not data.access_group.strip():
        raise HTTPException(
            status_code=400,
            detail={"error": "access_group is required and cannot be empty"},
        )

    # Validation: Check that at least one of model_names or model_ids is provided
    has_model_names: Final = data.model_names and len(data.model_names) > 0
    has_model_ids: Final = data.model_ids and len(data.model_ids) > 0

    if not has_model_names and not has_model_ids:
        raise HTTPException(
            status_code=400,
            detail={"error": "Either model_names or model_ids must be provided and non-empty"},
        )

    # If model_ids is provided, use it (more precise targeting)
    use_model_ids: Final = has_model_ids

    # Validate model_names exist in router (only if using model_names path)
    if not use_model_ids and has_model_names:
        assert data.model_names is not None
        all_valid, missing_models = validate_models_exist(
            model_names=data.model_names,
            llm_router=llm_router,
        )

        if not all_valid:
            raise HTTPException(
                status_code=400,

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Provide at least one entry in model_names or model_ids.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/model_access_group_management_endpoints.py:382 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/a39c7b37ad03a8da. Report an issue: GitHub.