[GH-ISSUE #4792] [Bug]: VLESS Reality flow is not saved or cleared on multi-inbound client (VLESS + Hysteria) still present in v3.2.6 #3328

Closed
opened 2026-10-31 20:31:40 +07:00 by bsakaguchi · 3 comments
Owner

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

Describe the bug

After upgrading to version 3.2.5, a bug appeared when saving a client that is attached to multiple inbounds at the same time: Hysteria and VLESS Reality. I have just updated to version 3.2.6, but unfortunately, the issue still persists.

How to reproduce the problem

  1. Create or edit a client and assign them to two inbounds simultaneously: one Hysteria and one VLESS Reality.
  2. On the main node, select xtls-rprx-vision in the flow setting.
  3. Save the client.
  4. Open the client modal/card again.

Expected behavior

The flow parameter should be correctly stored and rendered per-inbound, regardless of whether the client shares other non-VLESS inbounds (like Hysteria), just like it used to work flawlessly in version 3.2.0.

Actual behavior

  • If the client has only VLESS Reality, the flow setting is preserved correctly upon reopening.
  • If the client has both Hysteria + VLESS Reality:
    • Opening the client card shows an empty flow field (it fails to hydrate the form/UI dropdown).
    • If you have multiple nodes (Main + Additional): the flow value is saved on the main node during the initial setup, but it completely fails to save on the additional node. Re-opening the card wipes the flow setting, forcing the admin to re-select it every single time.

Relevant logs


Screenshots

When adding only vless reality, everything will be saved well even if the main and additional node are selected

Image Image

I added all the Vless + Hysteria connections, the primary and secondary nodes, selected flow xtls-rprx-vision, saved it, and went back to the card, but it was empty.

Image Image Image Image

The user in the screenshots deleted it, it was created for the sake of testing.

3x-ui version

3.2.6

Xray-core version

No response

How did you install 3x-ui?

install.sh script

Operating system

ubuntu 24.04

Which parts of the panel are affected?

Xray config generation

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 @VMMaster on GitHub (Jun 2, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/4792 ### Describe the bug After upgrading to version 3.2.5, a bug appeared when saving a client that is attached to multiple inbounds at the same time: **Hysteria** and **VLESS Reality**. I have just updated to version 3.2.6, but unfortunately, the issue still persists. ### How to reproduce the problem 1. Create or edit a client and assign them to two inbounds simultaneously: one Hysteria and one VLESS Reality. 2. On the main node, select `xtls-rprx-vision` in the **flow** setting. 3. Save the client. 4. Open the client modal/card again. ### Expected behavior The `flow` parameter should be correctly stored and rendered per-inbound, regardless of whether the client shares other non-VLESS inbounds (like Hysteria), just like it used to work flawlessly in version 3.2.0. ### Actual behavior - If the client has **only** VLESS Reality, the `flow` setting is preserved correctly upon reopening. - If the client has **both** Hysteria + VLESS Reality: - Opening the client card shows an empty `flow` field (it fails to hydrate the form/UI dropdown). - If you have multiple nodes (Main + Additional): the `flow` value is saved on the main node during the initial setup, but it completely fails to save on the additional node. Re-opening the card wipes the flow setting, forcing the admin to re-select it every single time. ### Relevant logs ```shell ``` ### Screenshots When adding only vless reality, everything will be saved well even if the main and additional node are selected <img width="701" height="929" alt="Image" src="https://github.com/user-attachments/assets/7de869ce-946c-45bc-937d-2376595c3226" /> <img width="702" height="1012" alt="Image" src="https://github.com/user-attachments/assets/b890bdc6-0823-4af3-a5f1-3474e74e6b0f" /> I added all the Vless + Hysteria connections, the primary and secondary nodes, selected flow xtls-rprx-vision, saved it, and went back to the card, but it was empty. <img width="706" height="1018" alt="Image" src="https://github.com/user-attachments/assets/88da1b6a-1647-48c8-85f5-00aa3825d394" /> <img width="701" height="1004" alt="Image" src="https://github.com/user-attachments/assets/22c6eb0f-858f-4aa5-9d35-f4767722c264" /> <img width="331" height="254" alt="Image" src="https://github.com/user-attachments/assets/3bcc145c-8f8c-459e-810c-d688487acaee" /> <img width="328" height="252" alt="Image" src="https://github.com/user-attachments/assets/23ac6e07-afad-47ec-af61-00f80a2b34ef" /> The user in the screenshots deleted it, it was created for the sake of testing. ### 3x-ui version 3.2.6 ### Xray-core version _No response_ ### How did you install 3x-ui? install.sh script ### Operating system ubuntu 24.04 ### Which parts of the panel are affected? Xray config generation ### 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:31:41 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

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

Thanks for the detailed report and screenshots — this is a real bug that can be traced to a specific line in the backend.

Root cause

When a client is saved to multiple inbounds, SyncInbound (web/service/client.go) is called once per inbound. Each call unconditionally overwrites the ClientRecord.Flow column in the clients table with whatever flow value the current inbound carries:

// line ~227 in SyncInbound
row.Flow = incoming.Flow

Because clientWithInboundFlow() correctly strips the flow to "" for Hysteria (which does not support XTLS Vision), the Hysteria sync call writes an empty string into ClientRecord.Flow. If Hysteria is processed after VLESS Reality, the canonical flow field ends up empty in the database.

The per-inbound flow_override column in the client_inbounds junction table is set correctly (VLESS Reality keeps "xtls-rprx-vision", Hysteria keeps ""). However, the clients-list API (/api/clients/list) returns ClientRecord.Flow — the now-empty value — not the junction-table override. This is what the edit form reads at load time, so the dropdown appears blank.

Why the "additional node" also fails

The multi-node sync path calls SyncInbound with the same set of inbound clients, so it hits the identical overwrite and ends up with ClientRecord.Flow = "" on the secondary node as well.

Minimal fix direction

In SyncInbound, only overwrite ClientRecord.Flow when the incoming value is non-empty, so a non-flow-capable inbound (Hysteria, WS, gRPC, etc.) cannot silently erase the canonical flow that a flow-capable inbound already stored:

if incoming.Flow \!= "" {
    row.Flow = incoming.Flow
}

Alternatively, the clients-list response could derive the display flow from the first flow-capable FlowOverride entry, making it independent of inbound processing order.

If you are able to patch your own build in the meantime, the one-liner above in SyncInbound around line 227 should restore the previous behaviour.

<!-- gh-comment-id:4598608487 --> @github-actions[bot] commented on GitHub (Jun 2, 2026): Thanks for the detailed report and screenshots — this is a real bug that can be traced to a specific line in the backend. **Root cause** When a client is saved to multiple inbounds, `SyncInbound` (`web/service/client.go`) is called once per inbound. Each call unconditionally overwrites the `ClientRecord.Flow` column in the `clients` table with whatever flow value the current inbound carries: ```go // line ~227 in SyncInbound row.Flow = incoming.Flow ``` Because `clientWithInboundFlow()` correctly strips the flow to `""` for Hysteria (which does not support XTLS Vision), the Hysteria sync call writes an empty string into `ClientRecord.Flow`. If Hysteria is processed after VLESS Reality, the canonical flow field ends up empty in the database. The per-inbound `flow_override` column in the `client_inbounds` junction table **is** set correctly (VLESS Reality keeps `"xtls-rprx-vision"`, Hysteria keeps `""`). However, the clients-list API (`/api/clients/list`) returns `ClientRecord.Flow` — the now-empty value — not the junction-table override. This is what the edit form reads at load time, so the dropdown appears blank. **Why the "additional node" also fails** The multi-node sync path calls `SyncInbound` with the same set of inbound clients, so it hits the identical overwrite and ends up with `ClientRecord.Flow = ""` on the secondary node as well. **Minimal fix direction** In `SyncInbound`, only overwrite `ClientRecord.Flow` when the incoming value is non-empty, so a non-flow-capable inbound (Hysteria, WS, gRPC, etc.) cannot silently erase the canonical flow that a flow-capable inbound already stored: ```go if incoming.Flow \!= "" { row.Flow = incoming.Flow } ``` Alternatively, the clients-list response could derive the display flow from the first flow-capable `FlowOverride` entry, making it independent of inbound processing order. If you are able to patch your own build in the meantime, the one-liner above in `SyncInbound` around line 227 should restore the previous behaviour.
Author
Owner

@VMMaster commented on GitHub (Jun 2, 2026):

In PostgreSQL, the client_inbounds table

5 and 7 inbound_id are hysteria

Image

This is the clients table

Image
<!-- gh-comment-id:4598659181 --> @VMMaster commented on GitHub (Jun 2, 2026): In PostgreSQL, the client_inbounds table 5 and 7 inbound_id are hysteria <img width="435" height="348" alt="Image" src="https://github.com/user-attachments/assets/e00f901f-5899-4d66-aa30-74446ab0df89" /> This is the clients table <img width="564" height="347" alt="Image" src="https://github.com/user-attachments/assets/78488627-f444-4cc0-85b3-3d93c8113086" />
Author
Owner

@MHSanaei commented on GitHub (Jun 2, 2026):

Fixed. The edit form now loads the correct flow for multi-inbound clients.

Root cause: SyncInbound runs once per inbound and unconditionally sets canonical clients.Flow. A non-flow inbound (Hysteria, WS, gRPC) strips flow to "", so when it syncs after the VLESS Reality inbound it wipes the column. The hydrate endpoint returned that wiped value, so the dropdown loaded blank. The per-inbound client_inbounds.flow_override was always correct (as your DB dump showed).

Fix: hydrate now derives the flow from the first flow-capable flow_override (order-independent) instead of the canonical column.

I went with this over the simpler if incoming.Flow != "" { ... } guard in SyncInbound on purpose — that guard would make flow impossible to clear (picking "no flow" leaves every inbound at "", so the old value would stick). Added regression tests for both the Hysteria-synced-last order and the cleared-flow case.

Note: this corrects the panel display/persistence. The actual xray config and share links already used the correct per-inbound flow, so connectivity wasn't affected — but the blank form could trick you into re-saving a cleared flow.

<!-- gh-comment-id:4602893810 --> @MHSanaei commented on GitHub (Jun 2, 2026): Fixed. The edit form now loads the correct flow for multi-inbound clients. **Root cause:** `SyncInbound` runs once per inbound and unconditionally sets canonical `clients.Flow`. A non-flow inbound (Hysteria, WS, gRPC) strips flow to `""`, so when it syncs *after* the VLESS Reality inbound it wipes the column. The hydrate endpoint returned that wiped value, so the dropdown loaded blank. The per-inbound `client_inbounds.flow_override` was always correct (as your DB dump showed). **Fix:** hydrate now derives the flow from the first flow-capable `flow_override` (order-independent) instead of the canonical column. I went with this over the simpler `if incoming.Flow != "" { ... }` guard in `SyncInbound` on purpose — that guard would make flow **impossible to clear** (picking "no flow" leaves every inbound at `""`, so the old value would stick). Added regression tests for both the Hysteria-synced-last order and the cleared-flow case. Note: this corrects the panel display/persistence. The actual xray config and share links already used the correct per-inbound flow, so connectivity wasn't affected — but the blank form could trick you into re-saving a cleared flow.
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#3328
No description provided.