7 views
-/https://github.com/berriai/litellm/issues/33381
GitHub · issue

#33381 [Bug]: Usage page crashes client-side — "Cannot read properties of undefined (reading 'spend')" on large / multi-page datasets

  • State: open
  • Author: @basel-deriv
  • Labels: bug, ui-dashboard

### Check for existing issues

- [x] I have searched the existing issues and checked that my issue is not a duplicate.

### What happened?

**What happened** On the admin UI **Usage** page (Cost tab, Global Usage), the page renders briefly then dies with **"This page couldn't load."** Browser console:

``` Uncaught TypeError: Cannot read properties of undefined (reading 'spend') at <usage chunk> (Array.forEach → Array.forEach, inside a useMemo) ```

The crashing line is the top-keys aggregation: ```js e[t].metrics.spend += s.metrics.spend // s.metrics is undefined ``` `s.metadata` (key_alias, tags) is present but `s.metrics` is undefined for one entry.

**Root cause (traced)** The page fetches only **page 1** of `/user/daily/activity` (`page_size=1000&page=1`), but on our deployment the response is **36 pages** — page 1 returns just **1 of the 7 requested days**. The client-side aggregation then runs over **incomplete data** and hits an entry whose `metrics` didn't come through on page 1 → `s.metrics.spend` throws.

It is **data-state dependent**: crashes on a large/populated dataset, renders fine on a small one (e.g. a low-traffic staging env). The backend data itself is we…

GitHub resolver

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

Refresh page
vote history (1 events)
#0 of 0 · 31d17h56m6s ago — entered · #import:https:::github.com:berriai:litellm post #2914
The right issue is harder because it requires coordinated configuration modeling, API and persistence changes, admin-interface work, authorization behavior, and cross-role testing. The left issue is narrower, centered on defensive client-side aggregation and correct handling of paginated usage data.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search