BerriAI/litellm · error · Exception

Error deleting agent from DB: {e}

Error message

Error deleting agent from DB: {e}

What it means

Generic wrapper raised by delete_agent_from_db when the Prisma delete (or its surrounding bookkeeping) throws — the original exception's text is interpolated and chained. This is the delete counterpart of the 'Error adding agent to DB' wrapper in the same file: it marks an infrastructure-level database failure during agent deletion, not a validation problem.

Source

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

            created_agent_dict: Final = created_agent.model_dump()
            if created_agent.object_permission is not None:
                try:
                    created_agent_dict["object_permission"] = created_agent.object_permission.model_dump()
                except Exception:
                    created_agent_dict["object_permission"] = created_agent.object_permission.dict()
            return AgentResponse(**created_agent_dict)
        except Exception as e:
            raise Exception(f"Error adding agent to DB: {e}")

    async def delete_agent_from_db(self, agent_id: str, prisma_client: PrismaClient) -> Mapping[str, object]:
        """
        Delete an agent from the database
        """
        try:
            deleted_agent: Final = await agents_table(prisma_client).delete(where={"agent_id": agent_id})
            return dict(deleted_agent)
        except Exception as e:
            raise Exception(f"Error deleting agent from DB: {e}")

    async def patch_agent_in_db(
        self,
        agent_id: str,
        agent: PatchAgentRequest,
        prisma_client: PrismaClient,
        updated_by: str,
    ) -> AgentResponse:
        """
        Patch an agent in the database.

        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

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Check the database error detail; verify the agent exists and DB is reachable.

Example fix

Check proxy logs for the DB error.
Defensive patterns

Strategy: try-catch

When it happens

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