BerriAI/litellm · error · Exception
Error adding attachment to DB: {e}
Error message
Error adding attachment to DB: {e} What it means
DB error wrapper in the policy attachment registry: creating the attachment row in Prisma raised (constraint violation, connection loss, etc.). The original exception is logged and re-raised with this prefix after the in-memory rollback.
Source
Thrown at litellm/proxy/policy_engine/attachment_registry.py:335
)
self.add_attachment(attachment)
return PolicyAttachmentDBResponse(
attachment_id=created_attachment.attachment_id,
policy_name=created_attachment.policy_name,
scope=created_attachment.scope,
teams=created_attachment.teams or [],
keys=created_attachment.keys or [],
models=created_attachment.models or [],
tags=created_attachment.tags or [],
created_at=created_attachment.created_at,
updated_at=created_attachment.updated_at,
created_by=created_attachment.created_by,
updated_by=created_attachment.updated_by,
)
except Exception as e:
verbose_proxy_logger.exception("Error adding attachment to DB: %s", e)
raise Exception(f"Error adding attachment to DB: {e}")
async def delete_attachment_from_db(
self,
attachment_id: str,
prisma_client: "PrismaClient",
) -> dict[str, str]:
"""
Delete a policy attachment from the database.
Args:
attachment_id: The ID of the attachment to delete
prisma_client: The Prisma client instance
Returns:
Dict with success message
"""
try:
# Get attachment before deletingView on GitHub (pinned to 77b7c6c40c)
Solutions
- Check database connectivity and the error detail; ensure the attachments table exists (run migrations).
- Retry the request; if a unique constraint fired, choose a different attachment name/ID.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at litellm/proxy/policy_engine/attachment_registry.py:335 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/5b911454266ec90e.
Report an issue: GitHub.