[GH-ISSUE #5457] [Bug]: Inbounds and Clients Not Displayed on Main Node After Import from Another Node (Port Conflict) #3817

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

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

Describe the bug

When importing data from another node, inbounds and their associated clients are not displayed on the main node if their port conflicts with a locally existing inbound.

How to reproduce the problem

Create a local inbound on the main node using a specific port.
Import inbounds and clients from a remote node.
Ensure that the imported inbounds include one or more entries using the same port as the local inbound.
Check the list of inbounds and clients on the main node.

Expected behavior

Imported inbounds and their associated clients should be displayed on the main node, even if there is a port conflict. Any conflicts should be handled explicitly (e.g., warning, merge, or port remapping).

Actual behavior

Imported inbounds and clients using a port already occupied by a local inbound are not shown on the main node.

Relevant logs


Screenshots

No response

3x-ui version

3.3.1

Xray-core version

No response

How did you install 3x-ui?

install.sh script

Operating system

24.04

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 @perci4ek13 on GitHub (Jun 20, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5457 ### Describe the bug When importing data from another node, inbounds and their associated clients are not displayed on the main node if their port conflicts with a locally existing inbound. ### How to reproduce the problem Create a local inbound on the main node using a specific port. Import inbounds and clients from a remote node. Ensure that the imported inbounds include one or more entries using the same port as the local inbound. Check the list of inbounds and clients on the main node. ### Expected behavior Imported inbounds and their associated clients should be displayed on the main node, even if there is a port conflict. Any conflicts should be handled explicitly (e.g., warning, merge, or port remapping). ### Actual behavior Imported inbounds and clients using a port already occupied by a local inbound are not shown on the main node. ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.3.1 ### Xray-core version _No response_ ### How did you install 3x-ui? install.sh script ### Operating system 24.04 ### 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:35:11 +07:00
Author
Owner

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

The described behavior is confirmed in the source, but the root cause differs depending on which import path is in use. Two distinct flows exist.

Path A — Manual JSON import (Inbounds page → Import button)

When a user exports inbound JSON from a remote 3x-ui panel and pastes it into the import dialog, the handler at internal/web/controller/inbound.go:363 (importInbound) strips the nodeId field to nil whenever that ID does not correspond to a node registered on this panel (lines 377–382). This makes the inbound a local inbound on the receiving panel.

AddInbound (internal/web/service/inbound.go:561) then calls checkPortConflict (internal/web/service/port_conflict.go:161). That function uses sameNode(candidate.NodeID, existing.NodeID) to scope conflicts: two inbounds on the same node share a port budget. Because the imported inbound now has NodeID = nil (local), it is compared against every other local inbound. If a local inbound already holds the same port and transport combination, the conflict is flagged and AddInbound returns an error — the import is blocked.

The error is surfaced to the frontend. jsonMsgObj (internal/web/controller/util.go:157) sends:

Something went wrong (port <N> (tcp) already used by inbound '<remark>' (#<id>) on *)

This appears as a red toast. The inbound is not created, so nothing appears in the list. There is currently no conflict-resolution step (port remapping, node assignment, warning-and-proceed).

Path B — Automatic node sync

When a remote 3x-ui instance is registered as a node, its traffic snapshots are processed by setRemoteTrafficLocked (internal/web/service/inbound_node.go:204). Here port conflicts between local and node inbounds are not a problem: the DB rows have different NodeID values, and sameNode returns false for them, so checkPortConflict never fires.

For tag collisions (two inbounds with the same Xray tag string), the sync resolves the conflict automatically: it first tries the node's original tag, then falls back to the n<nodeID>- prefixed form (pickFreeTag, lines 378–409). Only if both the original tag and the prefixed tag are already taken does the sync silently skip that inbound and emit a log warning (level Warning, not visible in the panel UI).


To triage this correctly, the following information is needed:

  1. Which import method are you using?
    • Manual JSON import via the Import button on the Inbounds page?
    • Automatic node sync by adding the remote 3x-ui instance under Node Management and letting it sync?
  2. If manual import: did you see an error toast when the import was attempted? If so, what did it say?
  3. If automatic sync: is the remote node shown as Online in Node Management, and what is its sync mode (all or selected)?
  4. The output of x-ui → option 7 (show logs) or the panel log file, filtered to setRemoteTraffic warnings, if the automatic sync path is in use.

Workaround for manual import (Path A): Edit the exported JSON before pasting — change the port field to a port not already in use on the receiving panel, then import. The conflict only exists for local inbounds sharing a port; node-assigned inbounds on different nodes may use the same port without conflict.


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

<!-- gh-comment-id:4760121593 --> @github-actions[bot] commented on GitHub (Jun 20, 2026): The described behavior is confirmed in the source, but the root cause differs depending on which import path is in use. Two distinct flows exist. **Path A — Manual JSON import (Inbounds page → Import button)** When a user exports inbound JSON from a remote 3x-ui panel and pastes it into the import dialog, the handler at `internal/web/controller/inbound.go:363` (`importInbound`) strips the `nodeId` field to `nil` whenever that ID does not correspond to a node registered on *this* panel (lines 377–382). This makes the inbound a local inbound on the receiving panel. `AddInbound` (`internal/web/service/inbound.go:561`) then calls `checkPortConflict` (`internal/web/service/port_conflict.go:161`). That function uses `sameNode(candidate.NodeID, existing.NodeID)` to scope conflicts: two inbounds on the same node share a port budget. Because the imported inbound now has `NodeID = nil` (local), it is compared against every other local inbound. If a local inbound already holds the same port and transport combination, the conflict is flagged and `AddInbound` returns an error — the import is blocked. The error is surfaced to the frontend. `jsonMsgObj` (`internal/web/controller/util.go:157`) sends: ``` Something went wrong (port <N> (tcp) already used by inbound '<remark>' (#<id>) on *) ``` This appears as a red toast. The inbound is not created, so nothing appears in the list. There is currently no conflict-resolution step (port remapping, node assignment, warning-and-proceed). **Path B — Automatic node sync** When a remote 3x-ui instance is registered as a node, its traffic snapshots are processed by `setRemoteTrafficLocked` (`internal/web/service/inbound_node.go:204`). Here port conflicts between local and node inbounds are **not** a problem: the DB rows have different `NodeID` values, and `sameNode` returns `false` for them, so `checkPortConflict` never fires. For tag collisions (two inbounds with the same Xray tag string), the sync resolves the conflict automatically: it first tries the node's original tag, then falls back to the `n<nodeID>-` prefixed form (`pickFreeTag`, lines 378–409). Only if *both* the original tag and the prefixed tag are already taken does the sync silently skip that inbound and emit a log warning (level `Warning`, not visible in the panel UI). --- To triage this correctly, the following information is needed: 1. Which import method are you using? - Manual JSON import via the Import button on the Inbounds page? - Automatic node sync by adding the remote 3x-ui instance under Node Management and letting it sync? 2. If manual import: did you see an error toast when the import was attempted? If so, what did it say? 3. If automatic sync: is the remote node shown as Online in Node Management, and what is its sync mode (`all` or `selected`)? 4. The output of `x-ui` → option 7 (show logs) or the panel log file, filtered to `setRemoteTraffic` warnings, if the automatic sync path is in use. **Workaround for manual import (Path A):** Edit the exported JSON before pasting — change the `port` field to a port not already in use on the receiving panel, then import. The conflict only exists for local inbounds sharing a port; node-assigned inbounds on different nodes may use the same port without conflict. --- *This reply was generated automatically; a maintainer may follow up.*
Author
Owner

@perci4ek13 commented on GitHub (Jun 20, 2026):

logs:
2026/06/20 22:25:53 WARNING - X-UI: setRemoteTraffic: create central inbound for tag "in-39989-tcp" failed: UNIQUE constraint failed: inbounds.port
2026/06/20 22:25:53 WARNING - X-UI: setRemoteTraffic: create central inbound for tag "inbound-6789" failed: UNIQUE constraint failed: inbounds.port
2026/06/20 22:25:53 WARNING - X-UI: setRemoteTraffic: create central inbound for tag "inbound-444" failed: UNIQUE constraint failed: inbounds.port
2026/06/20 22:25:53 WARNING - X-UI: setRemoteTraffic: create central inbound for tag "in-443-tcp" failed: UNIQUE constraint failed: inbounds.port
2026/06/20 22:25:48 WARNING - X-UI: setRemoteTraffic: create central inbound for tag "in-39989-tcp" failed: UNIQUE constraint failed: inbounds.port
2026/06/20 22:25:48 WARNING - X-UI: setRemoteTraffic: create central inbound for tag "inbound-6789" failed: UNIQUE constraint failed: inbounds.port
2026/06/20 22:25:48 WARNING - X-UI: setRemoteTraffic: create central inbound for tag "inbound-444" failed: UNIQUE constraint failed: inbounds.port
2026/06/20 22:25:48 WARNING - X-UI: setRemoteTraffic: create central inbound for tag "in-443-tcp" failed: UNIQUE constraint failed: inbounds.port

I am using the automatic method (node sync).

The behavior is the same for both selective import and full import — nothing changes.

In the case of selective import:

after clicking “load from node”, the data is actually displayed (it looks like the import was successful),
but it does not appear in the Inbounds tab.

So:

the synchronization visually completes,
but the inbounds are not actually written/committed into the inbounds list/state.

<!-- gh-comment-id:4760176077 --> @perci4ek13 commented on GitHub (Jun 20, 2026): logs: 2026/06/20 22:25:53 WARNING - X-UI: setRemoteTraffic: create central inbound for tag "in-39989-tcp" failed: UNIQUE constraint failed: inbounds.port 2026/06/20 22:25:53 WARNING - X-UI: setRemoteTraffic: create central inbound for tag "inbound-6789" failed: UNIQUE constraint failed: inbounds.port 2026/06/20 22:25:53 WARNING - X-UI: setRemoteTraffic: create central inbound for tag "inbound-444" failed: UNIQUE constraint failed: inbounds.port 2026/06/20 22:25:53 WARNING - X-UI: setRemoteTraffic: create central inbound for tag "in-443-tcp" failed: UNIQUE constraint failed: inbounds.port 2026/06/20 22:25:48 WARNING - X-UI: setRemoteTraffic: create central inbound for tag "in-39989-tcp" failed: UNIQUE constraint failed: inbounds.port 2026/06/20 22:25:48 WARNING - X-UI: setRemoteTraffic: create central inbound for tag "inbound-6789" failed: UNIQUE constraint failed: inbounds.port 2026/06/20 22:25:48 WARNING - X-UI: setRemoteTraffic: create central inbound for tag "inbound-444" failed: UNIQUE constraint failed: inbounds.port 2026/06/20 22:25:48 WARNING - X-UI: setRemoteTraffic: create central inbound for tag "in-443-tcp" failed: UNIQUE constraint failed: inbounds.port I am using the automatic method (node sync). The behavior is the same for both selective import and full import — nothing changes. In the case of selective import: after clicking “load from node”, the data is actually displayed (it looks like the import was successful), but it does not appear in the Inbounds tab. So: the synchronization visually completes, but the inbounds are not actually written/committed into the inbounds list/state.
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#3817
No description provided.