[GH-ISSUE #5903] [Bug]: Rare data inconsistency: client UUID in panel credentials differs from UUID in generated subscription links #4091

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

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

Describe the bug

Describe the bug

I encountered a rare but serious data inconsistency when creating a client through the API.

The client is created successfully, but the UUID shown in the panel credentials is different from the UUID used in the generated subscription links/configs.

In the panel UI, inside the client's credentials section, the UUID is shown as:

419fc244-e4ff-46c4-aea3-7fb42082a058

However, when I get the user's config from the subscription link, the generated VLESS config contains a different UUID:

ee068537-3b00-4b9a-8a98-d31b2dfe46f3

Example generated config from the subscription link:

vless://ee068537-3b00-4b9a-8a98-d31b2dfe46f3@help.example.space:443?alpn=h3%2Ch2%2Chttp%2F1.1&encryption=none&fp=chrome&host=&path=%2F%3Fed%3D2095&security=tls&sni=cdn.example.space&type=ws#Germany ExS1-vniacc6OiqCSAX_1

I have 4 nodes attached to this user/client, and all of them return the same wrong UUID in the subscription configs.

Restarting the panel from the Web UI did not fix the issue.

This issue is rare, but it is important because it can cause the panel UI, database/client record, and generated subscription configs to become inconsistent.

How to reproduce the problem

This issue is rare and does not happen every time, but the case happened with the following flow:

Use 3x-ui v3.4.2.
Create a new client using the API.
Confirm that the client is created successfully.
Open the client from the 3x-ui Web UI.
Check the client's UUID in the credentials section.
Open the user's subscription link.
Compare the UUID inside the generated VLESS configs with the UUID shown in the panel credentials.
In my case, the UUIDs were different.
Restart the panel from the Web UI.
Check the credentials and subscription link again.

Result: the inconsistency still remains after restart.

Example:

UUID shown in panel credentials:

419fc244-e4ff-46c4-aea3-7fb42082a058

UUID shown in subscription-generated VLESS config:

ee068537-3b00-4b9a-8a98-d31b2dfe46f3

The same wrong UUID is used for all 4 generated node configs for this client.

Expected behavior

The UUID shown in the panel credentials and the UUID used in generated subscription configs should always be the same.

Expected behavior:

When a client is created through the API, the stored client UUID should be consistent everywhere.
The Web UI credentials should show the same UUID that is used in subscription links.
All generated VLESS configs should use the same UUID as the client record.
Restarting the panel should not be required to synchronize this data.
The subscription generator should not use an old, cached, or different UUID for the same client.
Actual behavior

The client is created successfully through the API, but the UUID shown in the panel credentials is different from the UUID used in the generated subscription configs.

Actual result:

Panel credentials UUID:

419fc244-e4ff-46c4-aea3-7fb42082a058

Subscription config UUID:

ee068537-3b00-4b9a-8a98-d31b2dfe46f3

All 4 node configs generated for this user use the wrong subscription UUID.

Restarting the panel from the Web UI did not resolve the inconsistency.

This suggests that the client data used by the panel credentials and the data used by the subscription/config generator may come from different sources, stale cache, or an inconsistent client record after API creation.

Relevant logs

No visible backend error was shown in the Web UI.

The issue was detected by comparing the UUID shown in the panel credentials with the UUID inside the generated subscription config.

Panel credentials UUID:

419fc244-e4ff-46c4-aea3-7fb42082a058

Generated subscription config:

vless://ee068537-3b00-4b9a-8a98-d31b2dfe46f3@help.example.space:443?alpn=h3%2Ch2%2Chttp%2F1.1&encryption=none&fp=chrome&host=&path=%2F%3Fed%3D2095&security=tls&sni=cdn.example.space&type=ws#Germany ExS1-vniacc6OiqCSAX_1

UUID extracted from subscription config:

ee068537-3b00-4b9a-8a98-d31b2dfe46f3

Additional notes:

Client was created through the API.
The issue is rare and not reproduced on every client creation.
The same wrong UUID appears in all 4 node configs for this client.
Restarting the panel from the Web UI did not fix the issue.
This may indicate a synchronization, cache, subscription generation, or API client creation persistence issue.



### How to reproduce the problem


```markdown
This issue is rare and does not happen every time, but the case happened with the following flow:

1. Use 3x-ui `v3.4.2`.
2. Create a new client using the API.
3. Confirm that the client is created successfully.
4. Open the client from the 3x-ui Web UI.
5. Check the client's UUID in the credentials section.
6. Open the user's subscription link.
7. Compare the UUID inside the generated VLESS configs with the UUID shown in the panel credentials.
8. In my case, the UUIDs were different.
9. Restart the panel from the Web UI.
10. Check the credentials and subscription link again.

Result: the inconsistency still remains after restart.

Example:

UUID shown in panel credentials:

```text
419fc244-e4ff-46c4-aea3-7fb42082a058

### Expected behavior


---

## Expected behavior

```markdown
### Expected behavior

The UUID shown in the panel credentials and the UUID used in generated subscription configs should always be the same.

Expected behavior:

- When a client is created through the API, the stored client UUID should be consistent everywhere.
- The Web UI credentials should show the same UUID that is used in subscription links.
- All generated VLESS configs should use the same UUID as the client record.
- Restarting the panel should not be required to synchronize this data.
- The subscription generator should not use an old, cached, or different UUID for the same client.

### Actual behavior

### Actual behavior

The client is created successfully through the API, but the UUID shown in the panel credentials is different from the UUID used in the generated subscription configs.

Actual result:

Panel credentials UUID:

```text
419fc244-e4ff-46c4-aea3-7fb42082a058

### Relevant logs

```shell
---

## Relevant logs


### Relevant logs

No visible backend error was shown in the Web UI.

The issue was detected by comparing the UUID shown in the panel credentials with the UUID inside the generated subscription config.

Panel credentials UUID:


419fc244-e4ff-46c4-aea3-7fb42082a058

Screenshots

No response

3x-ui version

3.4.2

Xray-core version

26.6.27

How did you install 3x-ui?

install.sh script

Operating system

ubuntu 26

Which parts of the panel are affected?

No response

Browser (only if it is a UI bug)

No response

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 @HamedSanaei on GitHub (Jul 11, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5903 ### Describe the bug ## Describe the bug I encountered a rare but serious data inconsistency when creating a client through the API. The client is created successfully, but the UUID shown in the panel credentials is different from the UUID used in the generated subscription links/configs. In the panel UI, inside the client's credentials section, the UUID is shown as: ```text 419fc244-e4ff-46c4-aea3-7fb42082a058 However, when I get the user's config from the subscription link, the generated VLESS config contains a different UUID: ee068537-3b00-4b9a-8a98-d31b2dfe46f3 Example generated config from the subscription link: vless://ee068537-3b00-4b9a-8a98-d31b2dfe46f3@help.example.space:443?alpn=h3%2Ch2%2Chttp%2F1.1&encryption=none&fp=chrome&host=&path=%2F%3Fed%3D2095&security=tls&sni=cdn.example.space&type=ws#Germany ExS1-vniacc6OiqCSAX_1 I have 4 nodes attached to this user/client, and all of them return the same wrong UUID in the subscription configs. Restarting the panel from the Web UI did not fix the issue. This issue is rare, but it is important because it can cause the panel UI, database/client record, and generated subscription configs to become inconsistent. How to reproduce the problem This issue is rare and does not happen every time, but the case happened with the following flow: Use 3x-ui v3.4.2. Create a new client using the API. Confirm that the client is created successfully. Open the client from the 3x-ui Web UI. Check the client's UUID in the credentials section. Open the user's subscription link. Compare the UUID inside the generated VLESS configs with the UUID shown in the panel credentials. In my case, the UUIDs were different. Restart the panel from the Web UI. Check the credentials and subscription link again. Result: the inconsistency still remains after restart. Example: UUID shown in panel credentials: 419fc244-e4ff-46c4-aea3-7fb42082a058 UUID shown in subscription-generated VLESS config: ee068537-3b00-4b9a-8a98-d31b2dfe46f3 The same wrong UUID is used for all 4 generated node configs for this client. Expected behavior The UUID shown in the panel credentials and the UUID used in generated subscription configs should always be the same. Expected behavior: When a client is created through the API, the stored client UUID should be consistent everywhere. The Web UI credentials should show the same UUID that is used in subscription links. All generated VLESS configs should use the same UUID as the client record. Restarting the panel should not be required to synchronize this data. The subscription generator should not use an old, cached, or different UUID for the same client. Actual behavior The client is created successfully through the API, but the UUID shown in the panel credentials is different from the UUID used in the generated subscription configs. Actual result: Panel credentials UUID: 419fc244-e4ff-46c4-aea3-7fb42082a058 Subscription config UUID: ee068537-3b00-4b9a-8a98-d31b2dfe46f3 All 4 node configs generated for this user use the wrong subscription UUID. Restarting the panel from the Web UI did not resolve the inconsistency. This suggests that the client data used by the panel credentials and the data used by the subscription/config generator may come from different sources, stale cache, or an inconsistent client record after API creation. Relevant logs No visible backend error was shown in the Web UI. The issue was detected by comparing the UUID shown in the panel credentials with the UUID inside the generated subscription config. Panel credentials UUID: 419fc244-e4ff-46c4-aea3-7fb42082a058 Generated subscription config: vless://ee068537-3b00-4b9a-8a98-d31b2dfe46f3@help.example.space:443?alpn=h3%2Ch2%2Chttp%2F1.1&encryption=none&fp=chrome&host=&path=%2F%3Fed%3D2095&security=tls&sni=cdn.example.space&type=ws#Germany ExS1-vniacc6OiqCSAX_1 UUID extracted from subscription config: ee068537-3b00-4b9a-8a98-d31b2dfe46f3 Additional notes: Client was created through the API. The issue is rare and not reproduced on every client creation. The same wrong UUID appears in all 4 node configs for this client. Restarting the panel from the Web UI did not fix the issue. This may indicate a synchronization, cache, subscription generation, or API client creation persistence issue. ### How to reproduce the problem ```markdown This issue is rare and does not happen every time, but the case happened with the following flow: 1. Use 3x-ui `v3.4.2`. 2. Create a new client using the API. 3. Confirm that the client is created successfully. 4. Open the client from the 3x-ui Web UI. 5. Check the client's UUID in the credentials section. 6. Open the user's subscription link. 7. Compare the UUID inside the generated VLESS configs with the UUID shown in the panel credentials. 8. In my case, the UUIDs were different. 9. Restart the panel from the Web UI. 10. Check the credentials and subscription link again. Result: the inconsistency still remains after restart. Example: UUID shown in panel credentials: ```text 419fc244-e4ff-46c4-aea3-7fb42082a058 ### Expected behavior --- ## Expected behavior ```markdown ### Expected behavior The UUID shown in the panel credentials and the UUID used in generated subscription configs should always be the same. Expected behavior: - When a client is created through the API, the stored client UUID should be consistent everywhere. - The Web UI credentials should show the same UUID that is used in subscription links. - All generated VLESS configs should use the same UUID as the client record. - Restarting the panel should not be required to synchronize this data. - The subscription generator should not use an old, cached, or different UUID for the same client. ### Actual behavior ### Actual behavior The client is created successfully through the API, but the UUID shown in the panel credentials is different from the UUID used in the generated subscription configs. Actual result: Panel credentials UUID: ```text 419fc244-e4ff-46c4-aea3-7fb42082a058 ### Relevant logs ```shell --- ## Relevant logs ### Relevant logs No visible backend error was shown in the Web UI. The issue was detected by comparing the UUID shown in the panel credentials with the UUID inside the generated subscription config. Panel credentials UUID: 419fc244-e4ff-46c4-aea3-7fb42082a058 ``` ### Screenshots _No response_ ### 3x-ui version 3.4.2 ### Xray-core version 26.6.27 ### How did you install 3x-ui? install.sh script ### Operating system ubuntu 26 ### Which parts of the panel are affected? _No response_ ### Browser (only if it is a UI bug) _No response_ ### 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:37:06 +07:00
Author
Owner

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

Confirmed in source: the panel stores each client credential set in two separate places that are reconciled only under specific conditions, and there is a concrete code path where a repeated /panel/api/clients/add call can desync them. This matches every symptom in the report.

Title: Create (backing POST /panel/api/clients/add) can mint a fresh UUID for a client identity that already exists, desyncing the normalized client record from the inbound(s) that still hold the original credential

Severity: High

Category: Correctness

Why this matters:
3x-ui keeps two representations of a client:

  • The raw Xray-native clients[] array inside each inbound Settings JSON column — this is what Xray-core actually loads and enforces for that inbound.
  • A normalized clients table (model.ClientRecord), kept in sync from the JSON by SyncInbound (internal/web/service/client_link.go:12).

These two paths diverge for link generation:

  • The subscription generator resolves client credentials from the normalized clients table (internal/sub/service.go:252 matchingClients calling GetClientsBySubId, explicitly documented as "resolved from the normalized clients/client_inbounds tables ... instead of parsing the settings JSON").
  • The panel per-client link/credentials endpoint (GET /panel/api/clients/links/:email -> GetAllClientLinks -> internal/sub/links.go:38 LinksForClient) builds a fresh SubService per call with an empty cache, so it falls through to clientForLink (internal/sub/service.go:138), which parses that specific inbound raw Settings JSON directly via inboundService.GetClients(inbound).

Normally SyncInbound keeps clients.uuid equal to whatever is in the inbound JSON. But SyncInbound reconciles by email only, last write wins (internal/web/service/client_link.go:69-71, if incoming.UUID != "" { row.UUID = incoming.UUID }), and Create (internal/web/service/client_crud.go:45) does not guard against regenerating a credential for an identity that already exists:

  • Create allows a second call for an email that is already taken as long as the payload subId matches the stored one (client_crud.go:76-84) — this is the intended way to attach an existing identity to another inbound via /add.
  • But unlike Update (client_crud.go:335-341, which explicitly seeds updated.ID = existing.UUID when the payload omits it, with a comment stating this is precisely to stop fillProtocolDefaults from silently rotating the client UUID), Create never seeds client.ID from the existing record it already loaded for the collision check. It calls fillProtocolDefaults (client_crud.go:126) directly on the raw incoming payload.
  • Per the API docs (frontend/src/pages/api-docs/endpoints.ts:588), the UUID is generated server-side when omitted, so callers can send only the universal fields — so a caller that issues a separate /clients/add call per node/inbound for the same client email plus subId, omitting id each time (a reasonable reading of that same documentation), gets a new random UUID minted on every call. SyncInbound then overwrites the single shared clients.uuid row with whichever call ran last, while every other already-attached inbound Settings JSON — and therefore what is actually enforced there — keeps its own original UUID.
  • By contrast, Attach (client_crud.go:537) and BulkAttach (client_bulk.go:32) both correctly seed the outgoing client from the existing record (existing.ToClient() / rec.ToClient()) before calling fillProtocolDefaults, so they do not have this problem.

Net effect: subscription links (DB-table sourced) can silently diverge from one or more of the client actual per-inbound credentials (JSON sourced), with no error surfaced anywhere. Devices that pull the subscription authenticate correctly against at most one of the attached inbounds/nodes and silently fail on the rest. This is a DB-level data divergence, not a runtime cache, so restarting the panel, as the reporter tried, cannot fix it.

Recommendation: Mirror the existing-credential-preservation guard already in Update inside Create: when the email/subId collision check finds a matching existing record, seed client.ID/Password/Auth/Secret from existing (same fields Update already preserves) before calling fillProtocolDefaults, so a repeat /clients/add call for an already-existing identity reuses the stored credential instead of minting a new one — the same pattern Attach/BulkAttach already follow. Worth checking whether BulkCreate (client_bulk.go:1127) needs the same guard, since it processes each payload independently in the same way. Not opening a PR — happy to implement this if @MHSanaei confirms the approach.

Example:

internal/web/service/client_crud.go
  Create()               line 45   -- missing existing-credential reuse
  fillProtocolDefaults() line 126  -- mints a new UUID whenever c.ID == ""
  Update()                line 335  -- the correct pattern, for comparison
internal/web/service/client_link.go
  SyncInbound()           line 12, overwrite at line 69
internal/sub/service.go
  matchingClients()       line 252 (DB-sourced)
  clientForLink()         line 138 (JSON-sourced fallback)
internal/sub/links.go
  LinksForClient()        line 38

Confidence: Medium-high. Every element of this chain is confirmed directly in source on the current main (same as the reported v3.4.2, no relevant changes since), and it reproduces every reported symptom (rare, API-created, identical wrong UUID on all node-generated configs, unaffected by restart). What cannot be confirmed without more detail is the exact call sequence used, so that is requested below rather than assumed.

To pin down the exact trigger, please confirm:

  1. Was this client added to the 4 node inbounds via one /panel/api/clients/add call with all 4 inbound IDs in inboundIds, or via separate calls (e.g., one per node)?
  2. Did the request body include an explicit id field, or was it left blank?
  3. Does GET /panel/api/clients/get/:email currently return ee068537-... (the normalized record used by the subscription)? If so, which of the 4 inbounds raw settings (GET /panel/api/inbounds/get/:id) still contains 419fc244-..., and do the other inbounds each hold yet another distinct UUID?

@MHSanaei for visibility — this looks like a real gap in Create versus the safeguard already present in Update/Attach/BulkAttach.

This reply was generated automatically. A maintainer may follow up.

<!-- gh-comment-id:4947053423 --> @github-actions[bot] commented on GitHub (Jul 11, 2026): Confirmed in source: the panel stores each client credential set in two separate places that are reconciled only under specific conditions, and there is a concrete code path where a repeated `/panel/api/clients/add` call can desync them. This matches every symptom in the report. **Title:** `Create` (backing `POST /panel/api/clients/add`) can mint a fresh UUID for a client identity that already exists, desyncing the normalized client record from the inbound(s) that still hold the original credential **Severity:** High **Category:** Correctness **Why this matters:** 3x-ui keeps two representations of a client: - The raw Xray-native `clients[]` array inside each inbound Settings JSON column — this is what Xray-core actually loads and enforces for that inbound. - A normalized `clients` table (`model.ClientRecord`), kept in sync from the JSON by `SyncInbound` (`internal/web/service/client_link.go:12`). These two paths diverge for link generation: - The subscription generator resolves client credentials from the **normalized `clients` table** (`internal/sub/service.go:252` `matchingClients` calling `GetClientsBySubId`, explicitly documented as "resolved from the normalized clients/client_inbounds tables ... instead of parsing the settings JSON"). - The panel per-client link/credentials endpoint (`GET /panel/api/clients/links/:email` -> `GetAllClientLinks` -> `internal/sub/links.go:38` `LinksForClient`) builds a **fresh** `SubService` per call with an empty cache, so it falls through to `clientForLink` (`internal/sub/service.go:138`), which parses **that specific inbound raw Settings JSON** directly via `inboundService.GetClients(inbound)`. Normally `SyncInbound` keeps `clients.uuid` equal to whatever is in the inbound JSON. But `SyncInbound` reconciles by email only, last write wins (`internal/web/service/client_link.go:69-71`, `if incoming.UUID != "" { row.UUID = incoming.UUID }`), and `Create` (`internal/web/service/client_crud.go:45`) does not guard against regenerating a credential for an identity that already exists: - `Create` allows a second call for an email that is already taken as long as the payload `subId` matches the stored one (`client_crud.go:76-84`) — this is the intended way to attach an existing identity to another inbound via `/add`. - But unlike `Update` (`client_crud.go:335-341`, which explicitly seeds `updated.ID = existing.UUID` when the payload omits it, with a comment stating this is precisely to stop `fillProtocolDefaults` from silently rotating the client UUID), `Create` never seeds `client.ID` from the `existing` record it already loaded for the collision check. It calls `fillProtocolDefaults` (`client_crud.go:126`) directly on the raw incoming payload. - Per the API docs (`frontend/src/pages/api-docs/endpoints.ts:588`), the UUID is generated server-side when omitted, so callers can send only the universal fields — so a caller that issues a **separate** `/clients/add` call per node/inbound for the same client email plus subId, omitting `id` each time (a reasonable reading of that same documentation), gets a **new random UUID minted on every call**. `SyncInbound` then overwrites the single shared `clients.uuid` row with whichever call ran last, while every other already-attached inbound Settings JSON — and therefore what is actually enforced there — keeps its own original UUID. - By contrast, `Attach` (`client_crud.go:537`) and `BulkAttach` (`client_bulk.go:32`) both correctly seed the outgoing client from the existing record (`existing.ToClient()` / `rec.ToClient()`) before calling `fillProtocolDefaults`, so they do not have this problem. Net effect: subscription links (DB-table sourced) can silently diverge from one or more of the client actual per-inbound credentials (JSON sourced), with no error surfaced anywhere. Devices that pull the subscription authenticate correctly against at most one of the attached inbounds/nodes and silently fail on the rest. This is a DB-level data divergence, not a runtime cache, so restarting the panel, as the reporter tried, cannot fix it. **Recommendation:** Mirror the existing-credential-preservation guard already in `Update` inside `Create`: when the email/subId collision check finds a matching `existing` record, seed `client.ID`/`Password`/`Auth`/`Secret` from `existing` (same fields `Update` already preserves) before calling `fillProtocolDefaults`, so a repeat `/clients/add` call for an already-existing identity reuses the stored credential instead of minting a new one — the same pattern `Attach`/`BulkAttach` already follow. Worth checking whether `BulkCreate` (`client_bulk.go:1127`) needs the same guard, since it processes each payload independently in the same way. Not opening a PR — happy to implement this if @MHSanaei confirms the approach. **Example:** ``` internal/web/service/client_crud.go Create() line 45 -- missing existing-credential reuse fillProtocolDefaults() line 126 -- mints a new UUID whenever c.ID == "" Update() line 335 -- the correct pattern, for comparison internal/web/service/client_link.go SyncInbound() line 12, overwrite at line 69 internal/sub/service.go matchingClients() line 252 (DB-sourced) clientForLink() line 138 (JSON-sourced fallback) internal/sub/links.go LinksForClient() line 38 ``` **Confidence:** Medium-high. Every element of this chain is confirmed directly in source on the current `main` (same as the reported `v3.4.2`, no relevant changes since), and it reproduces every reported symptom (rare, API-created, identical wrong UUID on all node-generated configs, unaffected by restart). What cannot be confirmed without more detail is the exact call sequence used, so that is requested below rather than assumed. To pin down the exact trigger, please confirm: 1. Was this client added to the 4 node inbounds via **one** `/panel/api/clients/add` call with all 4 inbound IDs in `inboundIds`, or via **separate** calls (e.g., one per node)? 2. Did the request body include an explicit `id` field, or was it left blank? 3. Does `GET /panel/api/clients/get/:email` currently return `ee068537-...` (the normalized record used by the subscription)? If so, which of the 4 inbounds raw settings (`GET /panel/api/inbounds/get/:id`) still contains `419fc244-...`, and do the other inbounds each hold yet another distinct UUID? @MHSanaei for visibility — this looks like a real gap in `Create` versus the safeguard already present in `Update`/`Attach`/`BulkAttach`. *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#4091
No description provided.