BerriAI/litellm · error · HTTPException

access_group is required and cannot be empty

Error message

access_group is required and cannot be empty

What it means

Validation in access-group creation: data.access_group is empty/missing after truthiness checks, so the group cannot be named or registered.

Source

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

    - model_names: List[str] - List of existing model groups to include
    
    Returns:
    - NewModelGroupResponse with the created access group details
    
    Raises:
    - HTTPException 400: If any model names don't exist
    - HTTPException 500: If database operations fail
    """
    from litellm.proxy.proxy_server import (
        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)

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Provide a non-empty access_group value in the request body.
Defensive patterns

Strategy: validation

When it happens

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