BerriAI/litellm · error · ValueError
Invalid attachment: {e}
Error message
Invalid attachment: {e} What it means
Raised while loading policy attachments from YAML: _parse_attachment (Pydantic validation of one attachment dict) rejected the entry, so the malformed attachment is skipped and the parse error is logged with the cause.
Source
Thrown at litellm/proxy/policy_engine/attachment_registry.py:73
self._initialized: bool = False
def load_attachments(self, attachments_config: list[dict[str, Any]]) -> None:
"""
Load attachments from a configuration list.
Args:
attachments_config: List of attachment dictionaries from YAML.
"""
self._attachments = []
for attachment_data in attachments_config:
try:
attachment = self._parse_attachment(attachment_data)
self._attachments.append(attachment)
verbose_proxy_logger.debug("Loaded attachment for policy: %s", attachment.policy)
except Exception as e:
verbose_proxy_logger.error("Error loading attachment: %s", e)
raise ValueError(f"Invalid attachment: {e}") from e
self._config_attachments = tuple(self._attachments)
self._initialized = True
verbose_proxy_logger.info("Loaded %s policy attachments", len(self._attachments))
def _parse_attachment(self, attachment_data: dict[str, Any]) -> PolicyAttachment:
"""
Parse an attachment from raw configuration data.
Args:
attachment_data: Raw attachment configuration
Returns:
Parsed PolicyAttachment object
"""
return PolicyAttachment(
policy=attachment_data.get("policy", ""),
scope=attachment_data.get("scope"),View on GitHub (pinned to 77b7c6c40c)
Solutions
- Validate the attachment payload against the attachment schema (required fields, allowed types).
- Check the error detail for the specific validation failure and correct the request.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/proxy/policy_engine/attachment_registry.py:73 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/17cf8b823b4d4427.
Report an issue: GitHub.