{"record":{"id":"7e197950c5bdf71a","repo":"BerriAI/litellm","slug":"agent-with-name-agent-agent-name-already-in-publ","errorCode":null,"errorMessage":"Agent with name {agent.agent_name} already in public agent groups","messagePattern":"Agent with name (.+?) already in public agent groups","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/agent_endpoints/endpoints.py","lineNumber":886,"sourceCode":"                    \"error\": f\"Only proxy admins can update public model groups. Your role={user_api_key_dict.user_role}\"\n                },\n            )\n\n        agent = AGENT_REGISTRY.get_agent_by_id(agent_id=agent_id)\n        if agent is None:\n            # check if agent exists in DB\n            agent = await agents_table(prisma_client).find_unique(where={\"agent_id\": agent_id})\n            if agent is not None:\n                agent = AgentResponse(**agent.model_dump())\n\n            if agent is None:\n                raise HTTPException(status_code=404, detail=f\"Agent with ID {agent_id} not found\")\n\n        if litellm.public_agent_groups is None:\n            litellm.public_agent_groups = []\n        # handle duplicates\n        if not AGENT_REGISTRY.ids_for_agent(agent.agent_id).isdisjoint(litellm.public_agent_groups):\n            raise HTTPException(\n                status_code=400,\n                detail=f\"Agent with name {agent.agent_name} already in public agent groups\",\n            )\n        litellm.public_agent_groups.append(agent.agent_id)\n\n        # Load existing config\n        config: Final = await proxy_config.get_config()\n\n        # Update config with new settings\n        if \"litellm_settings\" not in config or config[\"litellm_settings\"] is None:\n            config[\"litellm_settings\"] = {}\n\n        config[\"litellm_settings\"][\"public_agent_groups\"] = litellm.public_agent_groups\n\n        # Save the updated config\n        await proxy_config.save_config(new_config=config)\n\n        verbose_proxy_logger.debug(","sourceCodeStart":868,"sourceCodeEnd":904,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/agent_endpoints/endpoints.py#L868-L904","documentation":"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.","triggerScenarios":"Thrown at litellm/proxy/agent_endpoints/endpoints.py:886 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the agent from public agent groups first, or use a different agent."],"exampleFix":"Check existing public agent groups before adding.","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}