{"record":{"id":"9c8257cb3357e0cb","repo":"BerriAI/litellm","slug":"error-patching-agent-in-db-e","errorCode":null,"errorMessage":"Error patching agent in DB: {e}","messagePattern":"Error patching agent in DB: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/proxy/agent_endpoints/agent_registry.py","lineNumber":447,"sourceCode":"            # Patch agent in DB\n            patched_agent: Final = await agents_table(prisma_client).update(\n                where={\"agent_id\": agent_id},\n                data={\n                    **update_data,\n                    \"updated_by\": updated_by,\n                    \"updated_at\": datetime.now(timezone.utc),\n                },\n                include={\"object_permission\": True},\n            )\n            patched_agent_dict: Final = patched_agent.model_dump()\n            if patched_agent.object_permission is not None:\n                try:\n                    patched_agent_dict[\"object_permission\"] = patched_agent.object_permission.model_dump()\n                except Exception:\n                    patched_agent_dict[\"object_permission\"] = patched_agent.object_permission.dict()\n            return AgentResponse(**patched_agent_dict)\n        except Exception as e:\n            raise Exception(f\"Error patching agent in DB: {e}\")\n\n    async def update_agent_in_db(\n        self,\n        agent_id: str,\n        agent: AgentConfig,\n        prisma_client: PrismaClient,\n        updated_by: str,\n    ) -> AgentResponse:\n        \"\"\"\n        Update an agent in the database\n        \"\"\"\n        try:\n            agent_name: Final = agent.get(\"agent_name\")\n\n            # Serialize litellm_params\n            litellm_params_obj: Final[Any] = agent.get(\"litellm_params\", {})\n            if hasattr(litellm_params_obj, \"model_dump\"):\n                litellm_params_dict = litellm_params_obj.model_dump()","sourceCodeStart":429,"sourceCodeEnd":465,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/agent_endpoints/agent_registry.py#L429-L465","documentation":"Generic wrapper raised in the agent patch path when the prisma update call (or the model_dump/permission serialization around it) throws; the original exception text is embedded and chained. It signals an infrastructure-level DB failure mid-patch — the agent was found and update_data assembled, but the write itself failed.","triggerScenarios":"Thrown at litellm/proxy/agent_endpoints/agent_registry.py:447 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the database error detail; validate the patch payload."],"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"}