[GH-ISSUE #5464] [Bug]: Clients Page Crashes on Page 2 #3822

Closed
opened 2026-10-31 20:35:12 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @ItsEhsanMM on GitHub (Jun 21, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5464

Describe the bug

When navigating to the second page of the Clients list, the web panel crashes and displays an "Unexpected Application Error".

How to reproduce the problem

1.Open the X-UI web panel.
2.Go to Clients.
3.Navigate to Page 2 of the clients list.
4.The page crashes immediately.

Expected behavior

The second page of clients should load normally.

Actual behavior

The application throws the following error:

Unexpected Application Error!
date value is not finite in DateTimeFormat.format()

Relevant logs

Stack Trace
formatDate@https://<REDACTED-IP>/assets/QueryProvider-5Z3Xx8d2.js:1:14540
An@https://<REDACTED-IP>/assets/ClientsPage-DhiRWxek.js:2:10516
render@https://<REDACTED-IP>/assets/ClientsPage-DhiRWxek.js:2:17642
...

Additional Notes
The issue only occurs when opening page 2 of the Clients list.
It appears that one of the client records contains an invalid or non-finite date value, causing DateTimeFormat.format() to fail.
The frontend should validate date values before formatting them and gracefully handle invalid dates instead of crashing the entire page.

Screenshots

No response

3x-ui version

3.3.1

Xray-core version

26.4.25

How did you install 3x-ui?

install.sh script

Operating system

ubuntu 24.0.4

Which parts of the panel are affected?

No response

Browser (only if it is a UI bug)

firefox

Is the panel behind a reverse proxy or CDN?

None

Before submitting

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).
Originally created by @ItsEhsanMM on GitHub (Jun 21, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5464 ### Describe the bug When navigating to the second page of the Clients list, the web panel crashes and displays an "Unexpected Application Error". ### How to reproduce the problem 1.Open the X-UI web panel. 2.Go to Clients. 3.Navigate to Page 2 of the clients list. 4.The page crashes immediately. ### Expected behavior The second page of clients should load normally. ### Actual behavior The application throws the following error: Unexpected Application Error! date value is not finite in DateTimeFormat.format() ### Relevant logs ```shell Stack Trace formatDate@https://<REDACTED-IP>/assets/QueryProvider-5Z3Xx8d2.js:1:14540 An@https://<REDACTED-IP>/assets/ClientsPage-DhiRWxek.js:2:10516 render@https://<REDACTED-IP>/assets/ClientsPage-DhiRWxek.js:2:17642 ... Additional Notes The issue only occurs when opening page 2 of the Clients list. It appears that one of the client records contains an invalid or non-finite date value, causing DateTimeFormat.format() to fail. The frontend should validate date values before formatting them and gracefully handle invalid dates instead of crashing the entire page. ``` ### Screenshots _No response_ ### 3x-ui version 3.3.1 ### Xray-core version 26.4.25 ### How did you install 3x-ui? install.sh script ### Operating system ubuntu 24.0.4 ### Which parts of the panel are affected? _No response_ ### Browser (only if it is a UI bug) firefox ### Is the panel behind a reverse proxy or CDN? None ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs).
bsakaguchi 2026-10-31 20:35:12 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@github-actions[bot] commented on GitHub (Jun 21, 2026):

The crash is caused by a missing validity check in IntlUtil.formatDate (frontend/src/utils/index.ts:937). The function calls intl.format(new Date(date)) without first verifying that the resulting Date object is finite and valid.

JavaScript's Date only accepts values up to ±8,640,000,000,000,000 milliseconds from the Unix epoch (roughly year 275,760). The backend stores ExpiryTime as a Go int64, which can hold values far beyond that limit. A client record whose expiryTime exceeds 8_640_000_000_000_000 will cause new Date(expiryTime) to return Invalid Date (whose .getTime() is NaN), and Intl.DateTimeFormat.format(Invalid Date) then throws "date value is not finite in DateTimeFormat.format()".

The rendering chain that triggers the crash in ClientsPage.tsx:

<Tooltip title={expiryLabel(record)}>   // line 781 — calls expiryLabel during render

expiryLabel (line 391–397) guards against 0, null, undefined, and negative values, but passes any positive value directly to IntlUtil.formatDate. A very large positive expiryTime that is outside the JavaScript Date range therefore reaches intl.format() unguarded.

Confirming the affected code (frontend/src/utils/index.ts:920–938):

static formatDate(date: string | number | Date | null | undefined, calendar: CalendarKind = 'gregorian'): string {
  if (date == null) return '';
  // ... locale setup ...
  const intl = new Intl.DateTimeFormat(locale, intlOptions);
  return intl.format(new Date(date));  // throws if new Date(date) is Invalid Date
}

Minimal fix — add a finite-check before calling format:

static formatDate(date: string | number | Date | null | undefined, calendar: CalendarKind = 'gregorian'): string {
  if (date == null) return '';
  const d = new Date(date);
  if (\!isFinite(d.getTime())) return '';
  // ... locale setup ...
  const intl = new Intl.DateTimeFormat(locale, intlOptions);
  return intl.format(d);
}

To identify the offending record you can query the database directly:

sqlite3 /etc/x-ui/x-ui.db \
  "SELECT email, expiry_time FROM client_traffics WHERE expiry_time > 8640000000000000 OR expiry_time < -8640000000000000;"

Any row returned has an expiry_time that JavaScript cannot represent as a valid Date. You can correct individual records through the panel's edit form (set expiry to a realistic date or to "never"), or via the API. Once the offending record is corrected the page will load again without a code change.

The fix in IntlUtil.formatDate should be applied in the source regardless, so that a single corrupt or out-of-range date value cannot crash the entire page for all users.

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:4761828833 --> @github-actions[bot] commented on GitHub (Jun 21, 2026): The crash is caused by a missing validity check in `IntlUtil.formatDate` (`frontend/src/utils/index.ts:937`). The function calls `intl.format(new Date(date))` without first verifying that the resulting `Date` object is finite and valid. JavaScript's `Date` only accepts values up to ±8,640,000,000,000,000 milliseconds from the Unix epoch (roughly year 275,760). The backend stores `ExpiryTime` as a Go `int64`, which can hold values far beyond that limit. A client record whose `expiryTime` exceeds `8_640_000_000_000_000` will cause `new Date(expiryTime)` to return `Invalid Date` (whose `.getTime()` is `NaN`), and `Intl.DateTimeFormat.format(Invalid Date)` then throws `"date value is not finite in DateTimeFormat.format()"`. The rendering chain that triggers the crash in `ClientsPage.tsx`: ``` <Tooltip title={expiryLabel(record)}> // line 781 — calls expiryLabel during render ``` `expiryLabel` (line 391–397) guards against `0`, `null`, `undefined`, and negative values, but passes any positive value directly to `IntlUtil.formatDate`. A very large positive `expiryTime` that is outside the JavaScript Date range therefore reaches `intl.format()` unguarded. **Confirming the affected code** (`frontend/src/utils/index.ts:920–938`): ```ts static formatDate(date: string | number | Date | null | undefined, calendar: CalendarKind = 'gregorian'): string { if (date == null) return ''; // ... locale setup ... const intl = new Intl.DateTimeFormat(locale, intlOptions); return intl.format(new Date(date)); // throws if new Date(date) is Invalid Date } ``` **Minimal fix** — add a finite-check before calling `format`: ```ts static formatDate(date: string | number | Date | null | undefined, calendar: CalendarKind = 'gregorian'): string { if (date == null) return ''; const d = new Date(date); if (\!isFinite(d.getTime())) return ''; // ... locale setup ... const intl = new Intl.DateTimeFormat(locale, intlOptions); return intl.format(d); } ``` **To identify the offending record** you can query the database directly: ```bash sqlite3 /etc/x-ui/x-ui.db \ "SELECT email, expiry_time FROM client_traffics WHERE expiry_time > 8640000000000000 OR expiry_time < -8640000000000000;" ``` Any row returned has an `expiry_time` that JavaScript cannot represent as a valid `Date`. You can correct individual records through the panel's edit form (set expiry to a realistic date or to "never"), or via the API. Once the offending record is corrected the page will load again without a code change. The fix in `IntlUtil.formatDate` should be applied in the source regardless, so that a single corrupt or out-of-range date value cannot crash the entire page for all users. *This reply was generated automatically; a maintainer may follow up.*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#3822
No description provided.