BerriAI/litellm · error · Exception

Error getting attachment from DB: {e}

Error message

Error getting attachment from DB: {e}

What it means

DB error wrapper in the policy attachment registry: fetching a single attachment by ID from Prisma raised; the exception is logged and re-raised with this prefix so callers see it as a registry DB failure.

Source

Thrown at litellm/proxy/policy_engine/attachment_registry.py:411

            if attachment is None:
                return None

            return PolicyAttachmentDBResponse(
                attachment_id=attachment.attachment_id,
                policy_name=attachment.policy_name,
                scope=attachment.scope,
                teams=attachment.teams or [],
                keys=attachment.keys or [],
                models=attachment.models or [],
                tags=attachment.tags or [],
                created_at=attachment.created_at,
                updated_at=attachment.updated_at,
                created_by=attachment.created_by,
                updated_by=attachment.updated_by,
            )
        except Exception as e:
            verbose_proxy_logger.exception("Error getting attachment from DB: %s", e)
            raise Exception(f"Error getting attachment from DB: {e}")

    async def get_all_attachments_from_db(
        self,
        prisma_client: "PrismaClient",
    ) -> list[PolicyAttachmentDBResponse]:
        """
        Get all policy attachments from the database.

        Args:
            prisma_client: The Prisma client instance

        Returns:
            List of PolicyAttachmentDBResponse objects
        """
        try:
            attachments: Final[Sequence[LiteLLM_PolicyAttachmentTable]] = await PolicyAttachmentRepository(
                prisma_client
            ).table.find_many(

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Check database connectivity and logs; verify the attachment ID exists, then retry.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at litellm/proxy/policy_engine/attachment_registry.py:411 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/35c84b4e2c55e5b1. Report an issue: GitHub.