[GH-ISSUE #5911] [Question]: how delete remained deleted client log #4098

Closed
opened 2026-10-31 20:37:09 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @sajadfaith on GitHub (Jul 12, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5911

What are you trying to do?

I see warning log about not found client in master panel and these client are not in master or any of nodes and these are deleted client how can clean my database from this warning? (database postgre)
2026/07/12 20:56:02 WARNING - X-UI: [GET /3v2cwgF7R1i2CwyiDC/panel/api/clients/get/leon_4214084 handler=controller.(*ClientController).get client.go:112] Failed: record not found
2026/07/12 20:56:02 ERROR - X-UI: Failed to localize message: message "get" not found in language "en-US"
2026/07/12 20:56:02 WARNING - X-UI: [GET /3v2cwgF7R1i2CwyiDC/panel/api/clients/get/shayan_1869610 handler=controller.(*ClientController).get client.go:112] Failed: record not found
2026/07/12 20:56:02 ERROR - X-UI: Failed to localize message: message "get" not found in language "en-US"
2026/07/12 20:55:02 WARNING - X-UI: [GET /3v2cwgF7R1i2CwyiDC/panel/api/clients/get/210571524_ae43 handler=controller.(*ClientController).get client.go:112] Failed: record not found
2026/07/12 20:55:02 ERROR - X-UI: Failed to localize message: message "get" not found in language "en-US"
2026/07/12 20:54:01 WARNING - X-UI: [GET /3v2cwgF7R1i2CwyiDC/panel/api/clients/get/amir14_6031593 handler=controller.(*ClientController).get client.go:112] Failed: record not found
2026/07/12 20:54:01 ERROR - X-UI: Failed to localize message: message "get" not found in language "en-US"
2026/07/12 20:54:01 WARNING - X-UI: [GET /3v2cwgF7R1i2CwyiDC/panel/api/clients/get/ali_3895256 handler=controller.(*ClientController).get client.go:112] Failed: record not found

What have you already tried?

No response

3x-ui version

3.5

How did you install 3x-ui?

install.sh script

Operating system

ubuntu22

Screenshots or config snippets

No response

Before submitting

  • I read the Wiki and searched existing issues.
  • This is a usage question, not a bug report.
  • This question is written in English.
Originally created by @sajadfaith on GitHub (Jul 12, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5911 ### What are you trying to do? I see warning log about not found client in master panel and these client are not in master or any of nodes and these are deleted client how can clean my database from this warning? (database postgre) 2026/07/12 20:56:02 WARNING - X-UI: [GET /3v2cwgF7R1i2CwyiDC/panel/api/clients/get/leon_4214084 handler=controller.(*ClientController).get client.go:112] Failed: record not found 2026/07/12 20:56:02 ERROR - X-UI: Failed to localize message: message "get" not found in language "en-US" 2026/07/12 20:56:02 WARNING - X-UI: [GET /3v2cwgF7R1i2CwyiDC/panel/api/clients/get/shayan_1869610 handler=controller.(*ClientController).get client.go:112] Failed: record not found 2026/07/12 20:56:02 ERROR - X-UI: Failed to localize message: message "get" not found in language "en-US" 2026/07/12 20:55:02 WARNING - X-UI: [GET /3v2cwgF7R1i2CwyiDC/panel/api/clients/get/210571524_ae43 handler=controller.(*ClientController).get client.go:112] Failed: record not found 2026/07/12 20:55:02 ERROR - X-UI: Failed to localize message: message "get" not found in language "en-US" 2026/07/12 20:54:01 WARNING - X-UI: [GET /3v2cwgF7R1i2CwyiDC/panel/api/clients/get/amir14_6031593 handler=controller.(*ClientController).get client.go:112] Failed: record not found 2026/07/12 20:54:01 ERROR - X-UI: Failed to localize message: message "get" not found in language "en-US" 2026/07/12 20:54:01 WARNING - X-UI: [GET /3v2cwgF7R1i2CwyiDC/panel/api/clients/get/ali_3895256 handler=controller.(*ClientController).get client.go:112] Failed: record not found ### What have you already tried? _No response_ ### 3x-ui version 3.5 ### How did you install 3x-ui? install.sh script ### Operating system ubuntu22 ### Screenshots or config snippets _No response_ ### Before submitting - [x] I read the [Wiki](https://github.com/MHSanaei/3x-ui/wiki) and searched [existing issues](../issues?q=is%3Aissue). - [x] This is a usage question, not a bug report. - [x] This question is written in English.
bsakaguchi 2026-10-31 20:37:09 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Jul 12, 2026):

These lines are not leftover data in the database — there is nothing to "clean." record not found is generated live, per request, only when something asks the panel for a client email that no longer has a matching row. Since those clients are already deleted, the lookup correctly fails and gets logged; nothing is stored anywhere that a cleanup action could remove.

Confirmed in the source:

  • GetRecordByEmail (internal/web/service/client_lookup.go:14-24) does a plain Where("email = ?", email).First(&row). GORM's miss is literally the error string record not found, which is what the warning reports (logged generically for any failed API call by jsonMsgObj, internal/web/controller/util.go:157-183) — this is identical on SQLite and PostgreSQL.
  • The only caller of GET /panel/api/clients/get/:email anywhere in this codebase is the hydrate() helper in frontend/src/hooks/useClients.ts:298-304, used only when an admin explicitly opens "Edit"/"Info"/"QR" or toggles enable/disable for a row in the Clients table (frontend/src/pages/clients/ClientsPage.tsx:462,503,509, useClients.ts:520). There is no background job anywhere in the repo that polls this endpoint by itself.

So the repeated hits for leon_4214084, shayan_1869610, etc. mean something that already has access to your panel (the URL contains your actual random web base path, so this isn't Xray or the nodes) is still asking about those specific emails — most likely a browser tab/session where the Clients table was left open from before they were deleted (a stale cached list still showing those rows), or an external script/integration hard-coded with those emails. Reloading that session/page stops the requests, and with them the log lines; there's no server-side row to purge.

If you were thinking of "Delete Orphans" (Clients page → bulk-actions menu → POST /panel/api/clients/delOrphans, ClientService.DeleteOrphans, internal/web/service/client_portable.go:168): that removes client_records rows that still exist but aren't attached to any inbound, which is a different situation — your emails already return "record not found" (no row at all), so it won't find anything to act on here.

Separately, while investigating I confirmed a real, unrelated bug in the same code path:

Title: Wrong i18n key ("get") used for error messages in several GET handlers
Severity: Low
Category: Correctness
Why this matters: the get handler builds its error message with I18nWeb(c, "get") (internal/web/controller/client.go:112,117,122,127), and the same literal key get is reused in internal/web/controller/inbound.go:137,446,451, internal/web/controller/node.go:92,108,158,195,208,298,338, and internal/web/controller/host.go:61 (15 call sites). No locale file under internal/web/translation/ (checked all 13) defines a message with ID get, so every time any of these handlers hits that error branch, internal/web/locale/locale.go:96-103 fails to localize it and logs Failed to localize message: ... at ERROR level — exactly the second line paired with each warning in your log. It also degrades the API response itself: jsonMsgObj (internal/web/controller/util.go:173) builds the message as msg + " (" + err + ")", and with msg resolving to "" you get both the double space visible in your log (client.go:112] Failed: ...) and a client-facing message reduced to " (record not found)" instead of a proper prefix.
Recommendation: replace I18nWeb(c, "get") at those 15 call sites with an existing, already-translated key such as somethingWentWrong (used by nearly every sibling error branch in the same files), or add a dedicated get key to all 13 locale JSON files under internal/web/translation/ if a more specific message is preferred.

@MHSanaei for awareness — a fix touches 4 controller files (and optionally 13 locale files), so I'm leaving the approach to a maintainer rather than opening a PR.

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

<!-- gh-comment-id:4952776796 --> @github-actions[bot] commented on GitHub (Jul 12, 2026): These lines are not leftover data in the database — there is nothing to "clean." `record not found` is generated live, per request, only when something asks the panel for a client email that no longer has a matching row. Since those clients are already deleted, the lookup correctly fails and gets logged; nothing is stored anywhere that a cleanup action could remove. Confirmed in the source: - `GetRecordByEmail` (`internal/web/service/client_lookup.go:14-24`) does a plain `Where("email = ?", email).First(&row)`. GORM's miss is literally the error string `record not found`, which is what the warning reports (logged generically for any failed API call by `jsonMsgObj`, `internal/web/controller/util.go:157-183`) — this is identical on SQLite and PostgreSQL. - The only caller of `GET /panel/api/clients/get/:email` anywhere in this codebase is the `hydrate()` helper in `frontend/src/hooks/useClients.ts:298-304`, used only when an admin explicitly opens "Edit"/"Info"/"QR" or toggles enable/disable for a row in the Clients table (`frontend/src/pages/clients/ClientsPage.tsx:462,503,509`, `useClients.ts:520`). There is no background job anywhere in the repo that polls this endpoint by itself. So the repeated hits for `leon_4214084`, `shayan_1869610`, etc. mean something that already has access to your panel (the URL contains your actual random web base path, so this isn't Xray or the nodes) is still asking about those specific emails — most likely a browser tab/session where the Clients table was left open from before they were deleted (a stale cached list still showing those rows), or an external script/integration hard-coded with those emails. Reloading that session/page stops the requests, and with them the log lines; there's no server-side row to purge. If you were thinking of "Delete Orphans" (Clients page → bulk-actions menu → `POST /panel/api/clients/delOrphans`, `ClientService.DeleteOrphans`, `internal/web/service/client_portable.go:168`): that removes `client_records` rows that still exist but aren't attached to any inbound, which is a different situation — your emails already return "record not found" (no row at all), so it won't find anything to act on here. Separately, while investigating I confirmed a real, unrelated bug in the same code path: Title: Wrong i18n key ("get") used for error messages in several GET handlers Severity: Low Category: Correctness Why this matters: the `get` handler builds its error message with `I18nWeb(c, "get")` (`internal/web/controller/client.go:112,117,122,127`), and the same literal key `get` is reused in `internal/web/controller/inbound.go:137,446,451`, `internal/web/controller/node.go:92,108,158,195,208,298,338`, and `internal/web/controller/host.go:61` (15 call sites). No locale file under `internal/web/translation/` (checked all 13) defines a message with ID `get`, so every time any of these handlers hits that error branch, `internal/web/locale/locale.go:96-103` fails to localize it and logs `Failed to localize message: ...` at ERROR level — exactly the second line paired with each warning in your log. It also degrades the API response itself: `jsonMsgObj` (`internal/web/controller/util.go:173`) builds the message as `msg + " (" + err + ")"`, and with `msg` resolving to `""` you get both the double space visible in your log (`client.go:112] Failed: ...`) and a client-facing message reduced to `" (record not found)"` instead of a proper prefix. Recommendation: replace `I18nWeb(c, "get")` at those 15 call sites with an existing, already-translated key such as `somethingWentWrong` (used by nearly every sibling error branch in the same files), or add a dedicated `get` key to all 13 locale JSON files under `internal/web/translation/` if a more specific message is preferred. @MHSanaei for awareness — a fix touches 4 controller files (and optionally 13 locale files), so I'm leaving the approach to a maintainer rather than opening a PR. *This reply was generated automatically; a maintainer may follow up.*
Author
Owner

@MHSanaei commented on GitHub (Jul 23, 2026):

Fixed in #6083. Uses a real i18n key in the client get handler, removing the 'message "get" not found' log spam (the record-not-found warnings themselves are benign).

<!-- gh-comment-id:5059092142 --> @MHSanaei commented on GitHub (Jul 23, 2026): Fixed in #6083. Uses a real i18n key in the client get handler, removing the 'message "get" not found' log spam (the record-not-found warnings themselves are benign).
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#4098
No description provided.