6 views
-/https://github.com/berriai/litellm/issues/30251
GitHub Ā· issue

#30251 [Bug]: Managed files - UniqueViolationError on model_object_id when the same provider object is re-registered under a new unified_object_id

  • State: open
  • Author: @hato-m
  • Labels: llm translation

### 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…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (1 events)
#0 of 0 Ā· 31d18h26m1s ago — entered Ā· #import:https:::github.com:berriai:litellm post #2422
The right issue is harder because it likely spans backend data flow, cache consistency, query behavior, and dashboard state, requiring broader debugging and cross-layer regression coverage. The left is comparatively localized to persistence conflict handling and idempotent update logic.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search