BerriAI/litellm · error · Exception

Error patching agent in DB: {e}

Error message

Error patching agent in DB: {e}

What it means

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.

Source

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

            # Patch agent in DB
            patched_agent: Final = await agents_table(prisma_client).update(
                where={"agent_id": agent_id},
                data={
                    **update_data,
                    "updated_by": updated_by,
                    "updated_at": datetime.now(timezone.utc),
                },
                include={"object_permission": True},
            )
            patched_agent_dict: Final = patched_agent.model_dump()
            if patched_agent.object_permission is not None:
                try:
                    patched_agent_dict["object_permission"] = patched_agent.object_permission.model_dump()
                except Exception:
                    patched_agent_dict["object_permission"] = patched_agent.object_permission.dict()
            return AgentResponse(**patched_agent_dict)
        except Exception as e:
            raise Exception(f"Error patching agent in DB: {e}")

    async def update_agent_in_db(
        self,
        agent_id: str,
        agent: AgentConfig,
        prisma_client: PrismaClient,
        updated_by: str,
    ) -> AgentResponse:
        """
        Update an agent in the database
        """
        try:
            agent_name: Final = agent.get("agent_name")

            # Serialize litellm_params
            litellm_params_obj: Final[Any] = agent.get("litellm_params", {})
            if hasattr(litellm_params_obj, "model_dump"):
                litellm_params_dict = litellm_params_obj.model_dump()

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Check the database error detail; validate the patch payload.

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:447 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/9c8257cb3357e0cb. Report an issue: GitHub.