BerriAI/litellm · error · Exception

Error getting agents from DB: {e}

Error message

Error getting agents from DB: {e}

What it means

Generic wrapper raised in get_agents_from_db when the prisma find_many over the agents table (or row serialization, e.g. object_permission model_dump) throws; the underlying exception text is embedded. It marks a database read failure while listing agents — connectivity, schema drift, or a malformed row — rather than an empty result (which returns an empty list normally).

Source

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

            agents_from_db: Final = await agents_table(prisma_client).find_many(
                order={"created_at": "desc"},
                include={"object_permission": True},
            )

            agents: Final[list[dict[str, object]]] = []
            for agent in agents_from_db:
                agent_dict = dict(agent)
                # object_permission is eagerly loaded via include above
                if agent.object_permission is not None:
                    try:
                        agent_dict["object_permission"] = agent.object_permission.model_dump()
                    except Exception:
                        agent_dict["object_permission"] = agent.object_permission.dict()
                agents.append(agent_dict)

            return agents
        except Exception as e:
            raise Exception(f"Error getting agents from DB: {e}")

    def get_agent_by_id(
        self,
        agent_id: str,
    ) -> AgentResponse | None:
        """
        Get an agent by its ID from the database
        """
        try:
            for agent in self.agent_list:
                if agent.agent_id == agent_id:
                    return agent

            translated_id: Final = self.config_agent_legacy_ids.get(agent_id)
            if translated_id is None:
                return None

            for agent in self.agent_list:

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Check database connectivity and the error detail.

Example fix

Verify DATABASE_URL and DB health.
Defensive patterns

Strategy: try-catch

When it happens

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