BerriAI/litellm · error · RuntimeError
Cannot resize budget reservation against inconsistent counte
Error message
Cannot resize budget reservation against inconsistent counter {counter_key} What it means
Error "Cannot resize budget reservation against inconsistent counter {counter_key}" thrown in BerriAI/litellm.
Source
Thrown at litellm/proxy/spend_tracking/budget_reservation.py:791
):
await _increment_spend_counter_cache(
counter_key=counter_key,
increment=adjustment,
)
elif reseed_on_inconsistent:
# Post-call reconcile / release: the counter was flushed or reseeded
# between reservation and reconcile (Redis restart / cross-pod reset),
# so the optimistic delta no longer applies. Recover by reseeding from
# the DB's lagging authoritative floor rather than deleting the counter
# and failing open — deleting it is what left budgets unenforced after a
# Redis reload.
await reseed_spend_counter_from_db(counter_key=counter_key)
else:
# Pre-call admission resize: the in-flight reservation cost is not yet
# persisted, so the DB floor would discard it. Keep the original
# fail-closed behavior (raise -> reserve_budget_for_request releases and
# denies) rather than admitting against an inconsistent counter.
raise RuntimeError(f"Cannot resize budget reservation against inconsistent counter {counter_key}")
entry["applied_adjustment"] = target_adjustment
async def _counter_can_apply_adjustment(
counter_key: str,
adjustment: float,
) -> bool:
from litellm.proxy.proxy_server import spend_counter_cache
current_value: Final = await spend_counter_cache.async_get_cache(key=counter_key)
if current_value is None:
return False
try:
current_float: Final = float(current_value)
except (TypeError, ValueError):
return False
View on GitHub (pinned to 77b7c6c40c)
Solutions
- Reset or repair the inconsistent spend counter (clear the Redis key or reconcile the DB counter), then retry the reservation.
When it happens
Trigger: Thrown at litellm/proxy/spend_tracking/budget_reservation.py:791 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/faa993742428471d.
Report an issue: GitHub.