{"record":{"id":"1752eb53d8e31951","repo":"BerriAI/litellm","slug":"agent-config-must-be-a-list-of-dictionaries","errorCode":null,"errorMessage":"agent_config must be a list of dictionaries","messagePattern":"agent_config must be a list of dictionaries","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/proxy/agent_endpoints/agent_registry.py","lineNumber":170,"sourceCode":"        return self.config_agent_legacy_ids.get(agent_id, agent_id)\n\n    def load_agents_from_config(self, agent_config: Sequence[AgentConfig] | None = None):\n        \"\"\"\n        Register the agents declared in config.yaml and remember them for later rebuilds.\n\n        A config entry is skipped when its ``agent_name`` is already registered, so a\n        database record always wins over a config entry that reuses its name and the\n        registry never holds two agents under one name. Enforcing that here rather than\n        in the caller keeps the guarantee independent of the order the two sources load\n        in. Passing ``None`` leaves the remembered agents untouched; passing an empty\n        sequence clears them.\n        \"\"\"\n        if agent_config is None:\n            return\n\n        for agent_config_item in agent_config:\n            if not isinstance(agent_config_item, dict):\n                raise ValueError(\"agent_config must be a list of dictionaries\")\n\n        self.config_agents = tuple(agent_config)\n        self.config_agent_legacy_ids = MappingProxyType(\n            {\n                self._create_legacy_agent_id(agent_config_item): self._create_agent_id(agent_config_item)\n                for agent_config_item in agent_config\n                if agent_config_item.get(\"agent_name\") and agent_config_item.get(\"agent_card_params\")\n            }\n        )\n\n        for agent_config_item in agent_config:\n            agent_name = agent_config_item.get(\"agent_name\")\n            agent_card_params = agent_config_item.get(\"agent_card_params\")\n            if not all([agent_name, agent_card_params]):\n                continue\n\n            if any(agent.agent_name == agent_name for agent in self.agent_list):\n                continue","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/agent_endpoints/agent_registry.py#L152-L188","documentation":"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.","triggerScenarios":"Thrown at litellm/proxy/agent_endpoints/agent_registry.py:170 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass agent_config as a list of dictionaries."],"exampleFix":"agent_config=[{'agent_name':'a', ...}]","handlingStrategy":"type-guard","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"}