[GH-ISSUE #5530] [Bug]: Cannot remove node without deleting remote inbound #3860

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

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

Describe the bug

The Nodes feature provides an option to remove a node from the panel:

Nodes -> Select node -> Remove

However, when trying to remove a node that has an attached inbound, the panel shows this error:

cannot delete node: 1 inbound(s) still attached to it; detach or delete them first

The problem is that there does not seem to be a way to detach an inbound from the node.

In the Inbounds tab, there is an option to detach a client, but there is no option to detach the inbound itself from the node.

The only available action appears to be deleting the inbound. However, deleting the inbound also deletes it from the remote node, which is not the intended action.

The intended action is only to remove the node from the local panel while keeping the remote node and its inbound working.

How to reproduce the problem

Add a remote node to the panel using the Nodes feature.

Make sure the node has at least one inbound attached or synchronized.

Go to:

Nodes -> Select node -> Remove

Try to remove the node.

The panel shows the following error:

cannot delete node: 1 inbound(s) still attached to it; detach or delete them first

Go to the Inbounds tab.

Try to find an option to detach the inbound from the node.

There is an option to detach a client, but there is no option to detach the inbound itself.

The only available option is to delete the inbound, but this deletes the inbound from the remote node instead of only detaching it from the local panel.

Expected behavior

The panel should allow removing a node from the local panel without deleting inbounds from the remote node.

If a node has attached inbounds, there should be a clear way to detach those inbounds locally.

For example, one of the following options would solve the issue:

Nodes -> Select node -> Remove from this panel only

or:

Inbounds -> Select inbound -> Detach inbound from node

or:

Nodes -> Select node -> Detach all inbounds and remove node

The important part is that removing a node from the local panel should not require deleting the inbound from the remote node.

The user should be able to remove the node connection while keeping the remote node fully working.

Actual behavior

The panel blocks node removal with the following error:

cannot delete node: 1 inbound(s) still attached to it; detach or delete them first

However, the UI does not provide a clear way to detach the inbound from the node.

The Inbounds tab provides an option to detach a client, but not to detach the inbound itself.

The only apparent workaround is to delete the inbound, but that removes the inbound from the remote node, which is dangerous and not the intended behavior.

As a result, the user cannot safely remove a node from the local panel while keeping the remote node and its inbound intact.

Relevant logs


Screenshots

No response

3x-ui version

3.4.0

Xray-core version

26.6.22

How did you install 3x-ui?

install.sh script

Operating system

Debian 12

Which parts of the panel are affected?

Multi-node (sub-nodes)

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 @atem32 on GitHub (Jun 24, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5530 ### Describe the bug The Nodes feature provides an option to remove a node from the panel: Nodes -> Select node -> Remove However, when trying to remove a node that has an attached inbound, the panel shows this error: cannot delete node: 1 inbound(s) still attached to it; detach or delete them first The problem is that there does not seem to be a way to detach an inbound from the node. In the `Inbounds` tab, there is an option to detach a client, but there is no option to detach the inbound itself from the node. The only available action appears to be deleting the inbound. However, deleting the inbound also deletes it from the remote node, which is not the intended action. The intended action is only to remove the node from the local panel while keeping the remote node and its inbound working. ### How to reproduce the problem Add a remote node to the panel using the Nodes feature. Make sure the node has at least one inbound attached or synchronized. Go to: Nodes -> Select node -> Remove Try to remove the node. The panel shows the following error: cannot delete node: 1 inbound(s) still attached to it; detach or delete them first Go to the `Inbounds` tab. Try to find an option to detach the inbound from the node. There is an option to detach a client, but there is no option to detach the inbound itself. The only available option is to delete the inbound, but this deletes the inbound from the remote node instead of only detaching it from the local panel. ### Expected behavior The panel should allow removing a node from the local panel without deleting inbounds from the remote node. If a node has attached inbounds, there should be a clear way to detach those inbounds locally. For example, one of the following options would solve the issue: Nodes -> Select node -> Remove from this panel only or: Inbounds -> Select inbound -> Detach inbound from node or: Nodes -> Select node -> Detach all inbounds and remove node The important part is that removing a node from the local panel should not require deleting the inbound from the remote node. The user should be able to remove the node connection while keeping the remote node fully working. ### Actual behavior The panel blocks node removal with the following error: cannot delete node: 1 inbound(s) still attached to it; detach or delete them first However, the UI does not provide a clear way to detach the inbound from the node. The `Inbounds` tab provides an option to detach a client, but not to detach the inbound itself. The only apparent workaround is to delete the inbound, but that removes the inbound from the remote node, which is dangerous and not the intended behavior. As a result, the user cannot safely remove a node from the local panel while keeping the remote node and its inbound intact. ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.4.0 ### Xray-core version 26.6.22 ### How did you install 3x-ui? install.sh script ### Operating system Debian 12 ### Which parts of the panel are affected? Multi-node (sub-nodes) ### 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:29 +07:00
Author
Owner

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

The error message is accurate but incomplete: the guard exists, yet no "detach inbound from node" operation is exposed anywhere in the UI or REST API. This is confirmed in the source.

Root cause — three interlocking facts

  1. Delete guard (internal/web/service/node.go:551–555): NodeService.Delete counts inbounds whose node_id equals the target node ID and rejects the delete if any are found:

    cannot delete node: N inbound(s) still attached to it; detach or delete them first
    
  2. No detach-inbound-from-node operation exists: The only "detach" endpoints in the API (POST /panel/api/clients/:email/detach, POST /panel/api/clients/bulkDetach) remove a client from an inbound, not an inbound from a node. InboundService.UpdateInbound (internal/web/service/inbound.go:969) explicitly locks the node assignment: inbound.NodeID = oldInbound.NodeID, so the standard edit path cannot clear node_id either. There is no API endpoint or UI action that sets inbound.node_id = NULL.

  3. Deleting an inbound pushes to the remote: InboundService.DelInbound (internal/web/service/inbound.go:760–775) calls rt.DelInbound() on the remote node when the node is enabled and reachable, which removes the inbound from the remote Xray config.

Workaround (no DB access required)

nodePushPlan (internal/web/service/inbound_node.go:51–52) skips the remote push when the node is disabled and instead marks the node dirty. This means you can delete the central inbound record locally without touching the remote, by disabling the node first:

  1. Nodes → find the node → toggle it off (the enable switch in the node list or node edit form).
  2. Inbounds → delete each inbound that belongs to that node. Because the node is now disabled, nodePushPlan returns push=false; the deletion is applied locally only and is not forwarded to the remote Xray instance.
  3. Nodes → delete the node — the inbound count is now zero so the guard passes.

The remote node and its Xray inbounds remain fully operational throughout.

What a proper fix looks like

A proper fix would require at minimum one of:

  • A new backend operation (e.g. PATCH /panel/api/inbounds/:id/node with {"nodeId": null}) that clears inbound.node_id without pushing a deletion to the remote.
  • A "remove node (keep remote inbounds)" option in the Nodes UI that bulk-clears node_id for all attached inbounds before deleting the node row.

Either approach would also need to decide what happens to the orphaned central inbound rows afterward (leave as local-only, or delete them — a policy question for the maintainers).

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

<!-- gh-comment-id:4787945643 --> @github-actions[bot] commented on GitHub (Jun 24, 2026): The error message is accurate but incomplete: the guard exists, yet no "detach inbound from node" operation is exposed anywhere in the UI or REST API. This is confirmed in the source. **Root cause — three interlocking facts** 1. **Delete guard** (`internal/web/service/node.go:551–555`): `NodeService.Delete` counts inbounds whose `node_id` equals the target node ID and rejects the delete if any are found: ``` cannot delete node: N inbound(s) still attached to it; detach or delete them first ``` 2. **No detach-inbound-from-node operation exists**: The only "detach" endpoints in the API (`POST /panel/api/clients/:email/detach`, `POST /panel/api/clients/bulkDetach`) remove a **client** from an inbound, not an **inbound** from a node. `InboundService.UpdateInbound` (`internal/web/service/inbound.go:969`) explicitly locks the node assignment: `inbound.NodeID = oldInbound.NodeID`, so the standard edit path cannot clear `node_id` either. There is no API endpoint or UI action that sets `inbound.node_id = NULL`. 3. **Deleting an inbound pushes to the remote**: `InboundService.DelInbound` (`internal/web/service/inbound.go:760–775`) calls `rt.DelInbound()` on the remote node when the node is enabled and reachable, which removes the inbound from the remote Xray config. **Workaround (no DB access required)** `nodePushPlan` (`internal/web/service/inbound_node.go:51–52`) skips the remote push when the node is **disabled** and instead marks the node dirty. This means you can delete the central inbound record locally without touching the remote, by disabling the node first: 1. **Nodes → find the node → toggle it off** (the enable switch in the node list or node edit form). 2. **Inbounds → delete each inbound** that belongs to that node. Because the node is now disabled, `nodePushPlan` returns `push=false`; the deletion is applied locally only and is not forwarded to the remote Xray instance. 3. **Nodes → delete the node** — the inbound count is now zero so the guard passes. The remote node and its Xray inbounds remain fully operational throughout. **What a proper fix looks like** A proper fix would require at minimum one of: - A new backend operation (e.g. `PATCH /panel/api/inbounds/:id/node` with `{"nodeId": null}`) that clears `inbound.node_id` without pushing a deletion to the remote. - A "remove node (keep remote inbounds)" option in the Nodes UI that bulk-clears `node_id` for all attached inbounds before deleting the node row. Either approach would also need to decide what happens to the orphaned central inbound rows afterward (leave as local-only, or delete them — a policy question for the maintainers). *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#3860
No description provided.