BerriAI/litellm · error · ValueError
agent_config must be a list of dictionaries
Error message
agent_config must be a list of dictionaries
What it means
Raised by AgentRegistry.load_agents_from_config when the agent_config value from config.yaml is neither a list nor contains non-dict entries — the loader expects a sequence of per-agent mapping objects. This is a config-shape error at proxy startup, before any agent registration happens; the offending agent_config block must be rewritten as a list of dicts.
Source
Thrown at litellm/proxy/agent_endpoints/agent_registry.py:170
return self.config_agent_legacy_ids.get(agent_id, agent_id)
def load_agents_from_config(self, agent_config: Sequence[AgentConfig] | None = None):
"""
Register the agents declared in config.yaml and remember them for later rebuilds.
A config entry is skipped when its ``agent_name`` is already registered, so a
database record always wins over a config entry that reuses its name and the
registry never holds two agents under one name. Enforcing that here rather than
in the caller keeps the guarantee independent of the order the two sources load
in. Passing ``None`` leaves the remembered agents untouched; passing an empty
sequence clears them.
"""
if agent_config is None:
return
for agent_config_item in agent_config:
if not isinstance(agent_config_item, dict):
raise ValueError("agent_config must be a list of dictionaries")
self.config_agents = tuple(agent_config)
self.config_agent_legacy_ids = MappingProxyType(
{
self._create_legacy_agent_id(agent_config_item): self._create_agent_id(agent_config_item)
for agent_config_item in agent_config
if agent_config_item.get("agent_name") and agent_config_item.get("agent_card_params")
}
)
for agent_config_item in agent_config:
agent_name = agent_config_item.get("agent_name")
agent_card_params = agent_config_item.get("agent_card_params")
if not all([agent_name, agent_card_params]):
continue
if any(agent.agent_name == agent_name for agent in self.agent_list):
continueView on GitHub (pinned to 77b7c6c40c)
Solutions
- Pass agent_config as a list of dictionaries.
Example fix
agent_config=[{'agent_name':'a', ...}] Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at litellm/proxy/agent_endpoints/agent_registry.py:170 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/1752eb53d8e31951.
Report an issue: GitHub.