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

#27171 [Bug] ResetBudgetJob crashes globally due to budget_limits list not being serialized to JSON in jsonify_object

  • State: open
  • Author: @stanislr

### Description When a key is created or updated with the "Budget Windows" feature (which populates the `budget_limits` field as a `List[BudgetLimitEntry]`), the global `ResetBudgetJob` crashes for all keys in the database.

**Root Cause:** In `litellm/proxy/utils.py`, the `jsonify_object` function is responsible for converting Python objects to JSON strings before saving them via Prisma. However, it only checks for dictionaries and completely misses lists:

```python def jsonify_object(data: dict) -> dict: db_data = copy.deepcopy(data) for k, v in db_data.items(): if isinstance(v, dict): # <--- MISSING LIST CHECK try: db_data[k] = json.dumps(v) except Exception: db_data[k] = "failed-to-serialize-json" return db_data ```

Because `budget_limits` is a list, it gets passed to Prisma as a raw Python list instead of a JSON string. When `ResetBudgetJob` runs `update_many` or `upsert` in `reset_budget_for_litellm_keys`, Prisma rejects the raw list for the JSON column, throwing the following error and crashing the entire batch:

```text Failed to reset budget for keys: Unable to match input value to any allowed i…

GitHub resolver

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

Refresh page
vote history (1 events)
#0 of 0 Ā· 31d17h51m18s ago — entered Ā· #import:https:::github.com:berriai:litellm post #3007
The right issue requires careful async cancellation handling, queue consistency, shutdown behavior, and regression tests across failure paths. The left issue is comparatively localized to serialization logic with a narrower validation surface.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search