BerriAI/litellm · error · HTTPException

Agent with name {agent.agent_name} already in public agent g

Error message

Agent with name {agent.agent_name} already in public agent groups

What it means

Raised while adding an agent to the public model groups when the (existing) agent's name is already present in the public groups list. The operation is idempotent-hostile by design — duplicate public entries would create ambiguous routing — so the add is rejected and the caller should remove the existing entry first or skip the add.

Source

Thrown at litellm/proxy/agent_endpoints/endpoints.py:886

                    "error": f"Only proxy admins can update public model groups. Your role={user_api_key_dict.user_role}"
                },
            )

        agent = AGENT_REGISTRY.get_agent_by_id(agent_id=agent_id)
        if agent is None:
            # check if agent exists in DB
            agent = await agents_table(prisma_client).find_unique(where={"agent_id": agent_id})
            if agent is not None:
                agent = AgentResponse(**agent.model_dump())

            if agent is None:
                raise HTTPException(status_code=404, detail=f"Agent with ID {agent_id} not found")

        if litellm.public_agent_groups is None:
            litellm.public_agent_groups = []
        # handle duplicates
        if not AGENT_REGISTRY.ids_for_agent(agent.agent_id).isdisjoint(litellm.public_agent_groups):
            raise HTTPException(
                status_code=400,
                detail=f"Agent with name {agent.agent_name} already in public agent groups",
            )
        litellm.public_agent_groups.append(agent.agent_id)

        # Load existing config
        config: Final = await proxy_config.get_config()

        # Update config with new settings
        if "litellm_settings" not in config or config["litellm_settings"] is None:
            config["litellm_settings"] = {}

        config["litellm_settings"]["public_agent_groups"] = litellm.public_agent_groups

        # Save the updated config
        await proxy_config.save_config(new_config=config)

        verbose_proxy_logger.debug(

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Remove the agent from public agent groups first, or use a different agent.

Example fix

Check existing public agent groups before adding.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/agent_endpoints/endpoints.py:886 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/7e197950c5bdf71a. Report an issue: GitHub.