BerriAI/litellm · error · Exception

Agent with ID {agent_id} not found

Error message

Agent with ID {agent_id} not found

What it means

Raised in the agent patch flow when AgentsRepository.find_unique for the given agent_id returns None — no database row exists to patch. Because patch semantics merge onto an existing record, a missing agent cannot be patched (use create instead), so the operation aborts before any update data is built.

Source

Thrown at litellm/proxy/agent_endpoints/agent_registry.py:394

        Get the existing agent from the database and patch it with the new values.

        Args:
            agent_id: The ID of the agent to patch
            agent: The new agent values to patch
            prisma_client: The Prisma client to use
            updated_by: The user ID of the user who is patching the agent

        Returns:
            The patched agent
        """
        try:
            existing_agent = await AgentsRepository(prisma_client).table.find_unique(where={"agent_id": agent_id})
            if existing_agent is not None:
                existing_agent = dict(existing_agent)

            if existing_agent is None:
                raise Exception(f"Agent with ID {agent_id} not found")

            augment_agent: Final = {**existing_agent, **agent}
            update_data: Final[dict[str, Any]] = {}
            if augment_agent.get("agent_name"):
                update_data["agent_name"] = augment_agent.get("agent_name")
            if augment_agent.get("litellm_params"):
                update_data["litellm_params"] = safe_dumps(augment_agent.get("litellm_params"))
            if augment_agent.get("agent_card_params"):
                update_data["agent_card_params"] = safe_dumps(augment_agent.get("agent_card_params"))

            for rate_field in (
                "tpm_limit",
                "rpm_limit",
                "session_tpm_limit",
                "session_rpm_limit",
            ):
                if rate_field in agent:
                    update_data[rate_field] = agent.get(rate_field)

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Verify the agent_id exists in the database.

Example fix

List agents to confirm the ID.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/agent_endpoints/agent_registry.py:394 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/ed1076d64e343c4d. Report an issue: GitHub.