BerriAI/litellm · error · HTTPException
Agent with name {request.get('agent_name')} already exists
Error message
Agent with name {request.get('agent_name')} already exists What it means
Agent creation checks the in-memory registry for a name conflict before inserting; duplicate agent_name would create ambiguous lookups (by-name resolution), so the create is rejected with the conflicting name.
Source
Thrown at litellm/proxy/agent_endpoints/endpoints.py:421
```
"""
await check_feature_access_for_user(user_api_key_dict, "agents")
from litellm.proxy.proxy_server import prisma_client
_check_agent_management_permission(user_api_key_dict)
if prisma_client is None:
raise HTTPException(status_code=500, detail="Prisma client not initialized")
try:
# Get the user ID from the API key auth
created_by: Final = user_api_key_dict.user_id or "unknown"
# check for naming conflicts
existing_agent: Final = AGENT_REGISTRY.get_agent_by_name(agent_name=request.get("agent_name"))
if existing_agent is not None:
raise HTTPException(
status_code=400,
detail=f"Agent with name {request.get('agent_name')} already exists",
)
# Apply the LiteLLM-fronting merge only when the admin actually
# provided an agent card. Plain chat/LLM agents register without
# ``agent_card_params``, and synthesising a default A2A card for them
# would advertise capabilities (``supportedInterfaces``, security
# schemes, default skills) the agent doesn't actually expose.
upstream_card: Final = request.get("agent_card_params")
agent_to_create: AgentConfig = request
new_agent_id: str | None = None
if upstream_card is not None:
# Pre-generate the agent_id so the merged card can reference it
# in ``supportedInterfaces`` before the DB row exists.
new_agent_id = str(uuid.uuid4())
merged_card: Final = _build_merged_agent_card(
upstream_card,View on GitHub (pinned to 77b7c6c40c)
Solutions
- Choose a different agent_name; names must be unique.
Example fix
agent_name='my-agent-2'
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/proxy/agent_endpoints/endpoints.py:421 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/a86f574baf6be7e8.
Report an issue: GitHub.