mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5457] [Bug]: Inbounds and Clients Not Displayed on Main Node After Import from Another Node (Port Conflict) #3817
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#3817
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
@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 thenodeIdfield tonilwhenever 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 callscheckPortConflict(internal/web/service/port_conflict.go:161). That function usessameNode(candidate.NodeID, existing.NodeID)to scope conflicts: two inbounds on the same node share a port budget. Because the imported inbound now hasNodeID = 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 andAddInboundreturns an error — the import is blocked.The error is surfaced to the frontend.
jsonMsgObj(internal/web/controller/util.go:157) sends: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 differentNodeIDvalues, andsameNodereturnsfalsefor them, socheckPortConflictnever 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 (levelWarning, not visible in the panel UI).To triage this correctly, the following information is needed:
allorselected)?x-ui→ option 7 (show logs) or the panel log file, filtered tosetRemoteTrafficwarnings, if the automatic sync path is in use.Workaround for manual import (Path A): Edit the exported JSON before pasting — change the
portfield 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.
@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.