#30251 [Bug]: Managed files - UniqueViolationError on model_object_id when the same provider object is re-registered under a new unified_object_id
### What happened?
When using LiteLLM Managed Files with the Anthropic passthrough (Files API + Message Batches), our proxy logs recurring unhandled exceptions in a fire-and-forget task:
``` prisma.errors.UniqueViolationError: Unique constraint failed on the fields: (model_object_id) Task exception was never retrieved ```
(~18 occurrences/day for only 2 actually-stored rows in our deployment ā the same provider objects get re-registered in a loop, e.g. every chat turn that re-references an already-uploaded managed file.)
### Root cause
`enterprise/litellm_enterprise/proxy/hooks/managed_files.py` ā `store_unified_object_id()` upserts into `LiteLLM_ManagedObjectTable` keyed on `unified_object_id`:
```python await self.prisma_client.db.litellm_managedobjecttable.upsert( where={"unified_object_id": unified_object_id}, ... ) ```
But the table also has a **separate UNIQUE constraint on `model_object_id`**. When the same provider object (same `model_object_id`) is re-registered under a **new** `unified_object_id`, the upsert finds no row for the new unified id, takes the `create` branch, and violates the `model_object_id` constraint. There is no conflict handling for that pā¦