litellm - 💡(How to fix) Fix [Bug] ResetBudgetJob fails on key/team batch updates when rows include relation and JSON fields

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

ResetBudgetJob in v1.83.14-stable fails while resetting key budgets because it batch-updates full LiteLLM_VerificationToken objects through update_data(query_type="update_many", table_name="key").

In production and dev, this breaks when a key row contains both:

  • object_permission_id
  • budget_limits

Observed error:

prisma.errors.DataError: Unable to match input value to any allowed input type for the field.
Parse errors: [
  `updateOneLiteLLM_VerificationToken.data.object_permission_id`: Field does not exist in enclosing type.,
  Unable to match input value to any allowed input type for the field. Parse errors: [Invalid argument type. `budget_limits` should be of any of the following types: `NullableJsonNullValueInput`, Invalid argument type. `budget_limits` should be of any of the following types: `Json`]
]

This was reproduced live on dev by:

  1. creating/updating a key so it has both object_permission_id and budget_limits
  2. setting budget_duration to 1s
  3. running ResetBudgetJob.reset_budget_for_litellm_keys() inside the pod

Error Message

prisma.errors.DataError: Unable to match input value to any allowed input type for the field. Parse errors: [ updateOneLiteLLM_VerificationToken.data.object_permission_id: Field does not exist in enclosing type., Unable to match input value to any allowed input type for the field. Parse errors: [Invalid argument type. budget_limits should be of any of the following types: NullableJsonNullValueInput, Invalid argument type. budget_limits should be of any of the following types: Json] ]

Root Cause

reset_budget_for_litellm_keys() builds updated_keys and then calls:

await self.prisma_client.update_data(
    query_type="update_many",
    data_list=updated_keys,
    table_name="key",
)

That path serializes and forwards the full key model into litellm_verificationtoken.update(...), which includes fields Prisma rejects in this update shape.

The team reset path has the same structure and can hit the same problem if team rows carry similar fields.

Fix Action

Fix / Workaround

This fix was hot-patched on dev and verified successfully:

  • pre-fix: exact Prisma failure reproduced
  • post-fix: reset completed successfully
  • the repro key's budget_reset_at advanced while still retaining object_permission_id and budget_limits

Code Example

prisma.errors.DataError: Unable to match input value to any allowed input type for the field.
Parse errors: [
  `updateOneLiteLLM_VerificationToken.data.object_permission_id`: Field does not exist in enclosing type.,
  Unable to match input value to any allowed input type for the field. Parse errors: [Invalid argument type. `budget_limits` should be of any of the following types: `NullableJsonNullValueInput`, Invalid argument type. `budget_limits` should be of any of the following types: `Json`]
]

---

await self.prisma_client.update_data(
    query_type="update_many",
    data_list=updated_keys,
    table_name="key",
)
RAW_BUFFERClick to expand / collapse

Description

ResetBudgetJob in v1.83.14-stable fails while resetting key budgets because it batch-updates full LiteLLM_VerificationToken objects through update_data(query_type="update_many", table_name="key").

In production and dev, this breaks when a key row contains both:

  • object_permission_id
  • budget_limits

Observed error:

prisma.errors.DataError: Unable to match input value to any allowed input type for the field.
Parse errors: [
  `updateOneLiteLLM_VerificationToken.data.object_permission_id`: Field does not exist in enclosing type.,
  Unable to match input value to any allowed input type for the field. Parse errors: [Invalid argument type. `budget_limits` should be of any of the following types: `NullableJsonNullValueInput`, Invalid argument type. `budget_limits` should be of any of the following types: `Json`]
]

This was reproduced live on dev by:

  1. creating/updating a key so it has both object_permission_id and budget_limits
  2. setting budget_duration to 1s
  3. running ResetBudgetJob.reset_budget_for_litellm_keys() inside the pod

Root Cause

reset_budget_for_litellm_keys() builds updated_keys and then calls:

await self.prisma_client.update_data(
    query_type="update_many",
    data_list=updated_keys,
    table_name="key",
)

That path serializes and forwards the full key model into litellm_verificationtoken.update(...), which includes fields Prisma rejects in this update shape.

The team reset path has the same structure and can hit the same problem if team rows carry similar fields.

Validated Fix

Instead of writing full key/team objects back during reset, batch-update only the fields the job actually mutates:

  • spend
  • budget_reset_at

This fix was hot-patched on dev and verified successfully:

  • pre-fix: exact Prisma failure reproduced
  • post-fix: reset completed successfully
  • the repro key's budget_reset_at advanced while still retaining object_permission_id and budget_limits

Related

  • Related to #27171
  • Related to PR #27646, which broadens the fix in generic key batch update handling

This issue proposes the narrower reset-job-side fix that was validated live against the failing path.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

litellm - 💡(How to fix) Fix [Bug] ResetBudgetJob fails on key/team batch updates when rows include relation and JSON fields