BerriAI/litellm · error · HTTPException

Agent with ID {agent_id} not found in DB.

Error message

Agent with ID {agent_id} not found in DB.

What it means

Agent delete/update against the DB found no row for the given agent_id after checking memory and database; the operation cannot proceed and reports the missing ID. A DB-backed existence check, not an auth failure.

Source

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

    ```
    """
    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:
        # Check if agent exists
        existing_agent = await agents_table(prisma_client).find_unique(where={"agent_id": agent_id})
        if existing_agent is not None:
            existing_agent = dict[str, object](existing_agent)

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

        await AGENT_REGISTRY.delete_agent_from_db(agent_id=agent_id, prisma_client=prisma_client)

        AGENT_REGISTRY.deregister_agent(agent_name=existing_agent.get("agent_name"))

        return {"message": f"Agent {agent_id} deleted successfully"}
    except HTTPException:
        raise
    except Exception as e:
        verbose_proxy_logger.exception("Error deleting agent: %s", e)
        raise HTTPException(status_code=500, detail=str(e))


@router.post(
    "/v1/agents/{agent_id}/make_public",
    tags=["[beta] A2A Agents"],
    dependencies=[Depends(user_api_key_auth)],
    response_model=AgentMakePublicResponse,

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Verify the agent_id exists in the database; list agents first.

Example fix

GET /agents to confirm the ID.
Defensive patterns

Strategy: validation

When it happens

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