BerriAI/litellm · error · HTTPException

A toolset named '{payload.toolset_name}' already exists.

Error message

A toolset named '{payload.toolset_name}' already exists.

What it means

Uniqueness guard on toolset creation: the DB raised UniqueViolationError because a toolset with the same toolset_name already exists; the endpoint converts it to HTTP 409 with the offending name interpolated.

Source

Thrown at litellm/proxy/management_endpoints/mcp_management_endpoints.py:2843

        """Create a named toolset — a curated selection of {server_id, tool_name} pairs."""
        prisma_client: Final = get_prisma_client_or_throw("Database not connected. Connect a database to your proxy")
        if LitellmUserRoles.PROXY_ADMIN != user_api_key_dict.user_role:
            raise HTTPException(
                status_code=status.HTTP_403_FORBIDDEN,
                detail={"error": "Only proxy admins can create MCP toolsets."},
            )
        touched_by: Final = (
            get_audit_log_changed_by(
                litellm_changed_by=litellm_changed_by,
                user_api_key_dict=user_api_key_dict,
                litellm_proxy_admin_name=LITELLM_PROXY_ADMIN_NAME,
            )
            or LITELLM_PROXY_ADMIN_NAME
        )
        try:
            result: Final = await create_mcp_toolset(prisma_client, payload, touched_by)
        except UniqueViolationError:
            raise HTTPException(
                status_code=status.HTTP_409_CONFLICT,
                detail={"error": f"A toolset named '{payload.toolset_name}' already exists."},
            )
        from litellm.proxy._experimental.mcp_server.mcp_server_manager import (
            global_mcp_server_manager,
        )

        global_mcp_server_manager.invalidate_toolset_cache()
        return result

    @router.get(
        "/toolset",
        description="List MCP toolsets accessible to the calling key",
    )
    @management_endpoint_wrapper
    async def fetch_mcp_toolsets(
        user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
    ):

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Choose a different toolset_name, or update the existing toolset instead.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/mcp_management_endpoints.py:2843 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/120ac7a0aebf971b. Report an issue: GitHub.