BerriAI/litellm · error · HTTPException

Tag {tag.name} already exists

Error message

Tag {tag.name} already exists

What it means

POST /tag/new found an existing LiteLLM_BudgetTable/tag record with the same tag_name: tags are unique by name, so the create is refused with 400 to prevent overwriting an existing tag's budget configuration.

Source

Thrown at litellm/proxy/management_endpoints/tag_management_endpoints.py:288

    - model_max_budget: Optional[dict] - Max budget for a specific model
    - budget_duration: Optional[str] - Frequency of resetting tag budget
    """
    from litellm.proxy._types import CommonProxyErrors
    from litellm.proxy.proxy_server import (
        litellm_proxy_admin_name,
        llm_router,
        prisma_client,
    )

    if prisma_client is None:
        raise HTTPException(status_code=500, detail=CommonProxyErrors.db_not_connected_error.value)
    if llm_router is None:
        raise HTTPException(status_code=500, detail=CommonProxyErrors.no_llm_router.value)
    try:
        # Check if tag already exists
        existing_tag: Final = await _table(TagRepository(prisma_client)).find_unique(where={"tag_name": tag.name})
        if existing_tag is not None:
            raise HTTPException(status_code=400, detail=f"Tag {tag.name} already exists")

        # Handle budget creation/assignment using common helper
        budget_id: Final = await handle_budget_for_entity(
            data=tag,
            existing_budget_id=None,
            user_api_key_dict=user_api_key_dict,
            prisma_client=prisma_client,
            litellm_proxy_admin_name=litellm_proxy_admin_name,
        )

        # Get model names for model_info
        model_info: Final = await _get_model_names(prisma_client, tag.models or [])

        # Create new tag in database
        new_tag_record: Final = await _table(TagRepository(prisma_client)).create(
            data={
                "tag_name": tag.name,
                "description": tag.description,

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Use a different tag name, or update the existing tag.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/tag_management_endpoints.py:288 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/cf88f20f1161edf4. Report an issue: GitHub.