BerriAI/litellm · error · HTTPException

models cannot be set to null; send [] to clear it

Error message

models cannot be set to null; send [] to clear it

What it means

Null-semantics guard on organization update: the payload sets models to null explicitly. Null is ambiguous for a list field, so the API requires an explicit empty list [] to clear the model scope; null is rejected with 422.

Source

Thrown at litellm/proxy/management_endpoints/organization_endpoints.py:812

            detail={"error": f"soft_budget must be a non-negative finite number. Received: {data.soft_budget}"},
        )
    if data.model_max_budget:
        from litellm.proxy.management_endpoints.key_management_endpoints import (
            validate_model_max_budget,
        )

        try:
            validate_model_max_budget(data.model_max_budget)
        except ValueError as e:
            raise HTTPException(status_code=422, detail={"error": str(e)})

    if "organization_alias" in data.model_fields_set and data.organization_alias is None:
        raise HTTPException(
            status_code=422,
            detail={"error": "organization_alias cannot be cleared; it is required"},
        )
    if "models" in data.model_fields_set and data.models is None:
        raise HTTPException(
            status_code=422,
            detail={"error": "models cannot be set to null; send [] to clear it"},
        )
    if data.object_permission is not None and not data.object_permission.model_dump(exclude_none=True):
        raise HTTPException(
            status_code=422,
            detail={
                "error": "object_permission cannot be an empty object; send null to clear it, or a non-empty object to set grants"
            },
        )

    await _verify_org_access(
        organization_id=organization_id,
        user_api_key_dict=user_api_key_dict,
        prisma_client=prisma_client,
    )

    existing_organization_row: Final = await _table(OrganizationRepository(prisma_client)).find_unique(

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Send [] to clear models instead of null.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/organization_endpoints.py:812 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/27657fa7297d37ff. Report an issue: GitHub.