BerriAI/litellm · error · Exception

Error syncing attachments from DB: {e}

Error message

Error syncing attachments from DB: {e}

What it means

Catch-all raised while rebuilding the in-memory attachment registry from DB rows: reading PolicyAttachment records or converting them to in-memory attachment objects failed, so the sync between database and in-memory state aborted; the original error is embedded.

Source

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

                    scope=attachment_response.scope,
                    teams=(attachment_response.teams if attachment_response.teams else None),
                    keys=attachment_response.keys if attachment_response.keys else None,
                    models=(attachment_response.models if attachment_response.models else None),
                    tags=attachment_response.tags if attachment_response.tags else None,
                )
                for attachment_response in attachments
            ]
            self._attachments = [*self._config_attachments, *db_attachments]

            self._initialized = True
            verbose_proxy_logger.info(
                "Synced %s attachments from DB to in-memory registry (%s config-defined attachments preserved)",
                len(attachments),
                len(self._config_attachments),
            )
        except Exception as e:
            verbose_proxy_logger.exception("Error syncing attachments from DB: %s", e)
            raise Exception(f"Error syncing attachments from DB: {e}")


# Global singleton instance
_attachment_registry: AttachmentRegistry | None = None


def get_attachment_registry() -> AttachmentRegistry:
    """
    Get the global AttachmentRegistry singleton.

    Returns:
        The global AttachmentRegistry instance
    """
    global _attachment_registry
    if _attachment_registry is None:
        _attachment_registry = AttachmentRegistry()
    return _attachment_registry

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Ensure the database is reachable and migrated; restart the proxy to re-run attachment sync.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at litellm/proxy/policy_engine/attachment_registry.py:488 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/043106db3edde73c. Report an issue: GitHub.