{"record":{"id":"6068c530b6a78e7b","repo":"BerriAI/litellm","slug":"error-deleting-agent-from-db-e","errorCode":null,"errorMessage":"Error deleting agent from DB: {e}","messagePattern":"Error deleting agent from DB: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/proxy/agent_endpoints/agent_registry.py","lineNumber":365,"sourceCode":"            created_agent_dict: Final = created_agent.model_dump()\n            if created_agent.object_permission is not None:\n                try:\n                    created_agent_dict[\"object_permission\"] = created_agent.object_permission.model_dump()\n                except Exception:\n                    created_agent_dict[\"object_permission\"] = created_agent.object_permission.dict()\n            return AgentResponse(**created_agent_dict)\n        except Exception as e:\n            raise Exception(f\"Error adding agent to DB: {e}\")\n\n    async def delete_agent_from_db(self, agent_id: str, prisma_client: PrismaClient) -> Mapping[str, object]:\n        \"\"\"\n        Delete an agent from the database\n        \"\"\"\n        try:\n            deleted_agent: Final = await agents_table(prisma_client).delete(where={\"agent_id\": agent_id})\n            return dict(deleted_agent)\n        except Exception as e:\n            raise Exception(f\"Error deleting agent from DB: {e}\")\n\n    async def patch_agent_in_db(\n        self,\n        agent_id: str,\n        agent: PatchAgentRequest,\n        prisma_client: PrismaClient,\n        updated_by: str,\n    ) -> AgentResponse:\n        \"\"\"\n        Patch an agent in the database.\n\n        Get the existing agent from the database and patch it with the new values.\n\n        Args:\n            agent_id: The ID of the agent to patch\n            agent: The new agent values to patch\n            prisma_client: The Prisma client to use\n            updated_by: The user ID of the user who is patching the agent","sourceCodeStart":347,"sourceCodeEnd":383,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/agent_endpoints/agent_registry.py#L347-L383","documentation":"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.","triggerScenarios":"Thrown at litellm/proxy/agent_endpoints/agent_registry.py:365 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the database error detail; verify the agent exists and DB is reachable."],"exampleFix":"Check proxy logs for the DB error.","handlingStrategy":"try-catch","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-14T00:17:10.932Z"}