[GH-ISSUE #6306] [Bug]: AWG inbounds can't be cloned / deployed to remote #4281

Closed
opened 2026-10-31 20:38:30 +07:00 by bsakaguchi · 7 comments
Owner

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

Describe the bug

AWG inbounds can't be cloned and created on remote nodes. Node selector disappears when amneziawg is selected

How to reproduce the problem

Add remote node
Try to deploy awg to remote node
Try to clone local to remote
Both fail

Expected behavior

No response

Actual behavior

No response

Relevant logs


Screenshots

No response

3x-ui version

3.7.0

Xray-core version

No response

How did you install 3x-ui?

Docker / Docker Compose

Operating system

Ubuntu 26.04

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 @rlex on GitHub (Aug 24, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6306 ### Describe the bug AWG inbounds can't be cloned and created on remote nodes. Node selector disappears when amneziawg is selected ### How to reproduce the problem Add remote node Try to deploy awg to remote node Try to clone local to remote Both fail ### Expected behavior _No response_ ### Actual behavior _No response_ ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.7.0 ### Xray-core version _No response_ ### How did you install 3x-ui? Docker / Docker Compose ### Operating system Ubuntu 26.04 ### 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:38:30 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@rlex commented on GitHub (Aug 24, 2026):

Since remote cloning was my work i'll check it out - nodes probably doesn't advertise awg capability (yes, all are updated to 3.7.0)
If root case is same might be able to fix both.

<!-- gh-comment-id:5400923458 --> @rlex commented on GitHub (Aug 24, 2026): Since remote cloning was my work i'll check it out - nodes probably doesn't advertise awg capability (yes, all are updated to 3.7.0) If root case is same might be able to fix both.
Author
Owner

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

This is intentional, not a regression: AmneziaWG is deliberately excluded from the protocols that may live on a sub-node, so the Deploy To selector is hidden when you pick amneziawg, and Clone falls back to the local-only one-click clone. The restriction shipped together with AmneziaWG itself in v3.7.0 and is enforced in three places — so what is being asked for here is an enhancement (extend node deployment to AmneziaWG), not a bug fix.

On the hypothesis in your comment: there is no per-protocol capability negotiation between master and node to be missing. The only capability token that exists is zstd — internal/util/wirecodec/wirecodec.go:18-22 (CapsHeader = "X-3x-Node-Caps", CapZstd = "zstd"), consumed by Remote.recordCaps (internal/web/runtime/remote.go:132), which sets nothing but supportsZstd. The gate is a static protocol list plus a server-side guard.

Where the behaviour comes from

The node-eligible set simply does not contain amneziawg — frontend/src/lib/xray/node-protocols.ts:9:

export const NODE_ELIGIBLE_PROTOCOLS: Readonly<Record<string, true>> = {
  [Protocols.VLESS]: true,
  [Protocols.VMESS]: true,
  [Protocols.TROJAN]: true,
  [Protocols.SHADOWSOCKS]: true,
  [Protocols.HYSTERIA]: true,
  [Protocols.WIREGUARD]: true,
};

WIREGUARD is in that list, but AmneziaWG is a distinct protocol value (amneziawg, internal/database/model/model.go:35), so it does not inherit WireGuard's eligibility.

  1. Selector disappears — frontend/src/pages/inbounds/form/InboundFormModal.tsx:252 and :617:
    const isNodeEligible = !!NODE_ELIGIBLE_PROTOCOLS[protocol];
    ...
    {selectableNodes.length > 0 && isNodeEligible && (
      <FormField name="nodeId" label={t('pages.inbounds.deployTo')}>
    
  2. Clone shows no target picker — frontend/src/pages/inbounds/InboundsPage.tsx:556: the multi-target dialog only opens for NODE_ELIGIBLE_PROTOCOLS[dbInbound.protocol]; everything else takes the "original one-click local clone" branch.
  3. The API refuses it too, so this is not just a hidden UI control — internal/web/service/inbound.go:962:
    if inbound.NodeID != nil && !isNodeEligibleProtocol(inbound.Protocol) {
        return inbound, false, common.NewErrorf("%s inbounds cannot be assigned to a node", inbound.Protocol)
    }
    
    (the same guard is repeated on update at internal/web/service/inbound.go:1500).

The intent is stated in the source and pinned by a test, so this is not an oversight:

// internal/web/service/inbound_protocol.go:56
// nodeEligibleProtocols mirrors the frontend's NODE_ELIGIBLE_PROTOCOLS. The
// sidecar-managed protocols are absent because their reconcile loops only query
// NodeID IS NULL rows, so a node-assigned one would never be reconciled at all.

TestIsNodeEligibleProtocol (internal/web/service/inbound_protocol_test.go:95) asserts model.AmneziaWG is ineligible. The underlying constraint is real: the desired-state query for the embedded AmneziaWG runtime is local-only — internal/web/service/inbound_amneziawg.go:31, Where("protocol = ? AND enable = ? AND node_id IS NULL", model.AmneziaWG, true) — so a row with a node_id would never be reconciled by the master's amneziawg_job.

Workaround today

Create the AmneziaWG inbound directly in the sub-node's own panel UI, where it is a local inbound: every 3x-ui instance schedules the reconcile job unconditionally (internal/web/web.go:338, awgJob := job.NewAmneziaWGJob()), master or node. The trade-off is ownership — the master panel will not list that inbound, manage its clients, or aggregate its traffic. I read this from the code; I cannot run a panel here to demonstrate it.

Documentation is misleading here and is worth correcting regardless of whether the restriction is lifted — docs/content/docs/en/config/amneziawg.mdx:171 says multi-node paths "likely work (the reconciler runs the same way regardless of how the panel itself is deployed)", while the code hard-blocks node assignment.

Verdict: Not a bug (expected behaviour)
Severity: N/A
Confidence: High
Root cause: No defect. amneziawg is absent from NODE_ELIGIBLE_PROTOCOLS (frontend/src/lib/xray/node-protocols.ts:9) and from nodeEligibleProtocols (internal/web/service/inbound_protocol.go:60), which hides the Deploy To field (InboundFormModal.tsx:617), routes Clone to the local branch (InboundsPage.tsx:556) and makes the add/update API reject a node-assigned AmneziaWG inbound (inbound.go:962, inbound.go:1500). Both lists were introduced by the AmneziaWG feature commit itself, effcccce feat(amneziawg): add native AmneziaWG protocol support (#6105).
Already fixed: Not applicable — the restriction is present and deliberate on the default branch (git tag --contains effcccce → v3.7.0, the reporter's version).
Duplicate of: None. Related: #6302 (AmneziaWG for outbounds) — different surface, not the same root cause.
Evidence: frontend/src/lib/xray/node-protocols.ts:9-16 (list without amneziawg); frontend/src/pages/inbounds/form/InboundFormModal.tsx:252,617; frontend/src/pages/inbounds/InboundsPage.tsx:556-563; internal/web/service/inbound_protocol.go:56-67; internal/web/service/inbound.go:962-964 and :1500-1502; internal/web/service/inbound_protocol_test.go:95-107 (TestIsNodeEligibleProtocol, ineligible set includes model.AmneziaWG); internal/web/service/inbound_amneziawg.go:31 (node_id IS NULL); internal/web/web.go:338-340 (job scheduled in every instance); internal/util/wirecodec/wirecodec.go:18-22 (zstd is the only node capability token); docs/content/docs/en/config/amneziawg.mdx:167-177.
Not determined: Whether lifting the restriction is wanted — a node push would go out via Remote.AddInbound (internal/web/runtime/remote.go:412) to the child panel's /panel/api/inbounds/add, where the row would be local and reconcilable, so the block may be conservative rather than structural. Only the maintainer can settle that; it is a design decision, not something the source answers.

Note: the bug label and the [Bug]: title prefix are unchanged — the label and title edits this analysis would have made (swap bug → enhancement) were refused by this environment's permissions, so a maintainer needs to apply them by hand.

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

<!-- gh-comment-id:5400961556 --> @github-actions[bot] commented on GitHub (Aug 24, 2026): This is intentional, not a regression: AmneziaWG is deliberately excluded from the protocols that may live on a sub-node, so the **Deploy To** selector is hidden when you pick `amneziawg`, and **Clone** falls back to the local-only one-click clone. The restriction shipped together with AmneziaWG itself in v3.7.0 and is enforced in three places — so what is being asked for here is an enhancement (extend node deployment to AmneziaWG), not a bug fix. On the hypothesis in your comment: there is no per-protocol capability negotiation between master and node to be missing. The only capability token that exists is `zstd` — `internal/util/wirecodec/wirecodec.go:18-22` (`CapsHeader = "X-3x-Node-Caps"`, `CapZstd = "zstd"`), consumed by `Remote.recordCaps` (`internal/web/runtime/remote.go:132`), which sets nothing but `supportsZstd`. The gate is a static protocol list plus a server-side guard. **Where the behaviour comes from** The node-eligible set simply does not contain `amneziawg` — `frontend/src/lib/xray/node-protocols.ts:9`: ```ts export const NODE_ELIGIBLE_PROTOCOLS: Readonly<Record<string, true>> = { [Protocols.VLESS]: true, [Protocols.VMESS]: true, [Protocols.TROJAN]: true, [Protocols.SHADOWSOCKS]: true, [Protocols.HYSTERIA]: true, [Protocols.WIREGUARD]: true, }; ``` `WIREGUARD` is in that list, but AmneziaWG is a distinct protocol value (`amneziawg`, `internal/database/model/model.go:35`), so it does not inherit WireGuard's eligibility. 1. **Selector disappears** — `frontend/src/pages/inbounds/form/InboundFormModal.tsx:252` and `:617`: ```tsx const isNodeEligible = !!NODE_ELIGIBLE_PROTOCOLS[protocol]; ... {selectableNodes.length > 0 && isNodeEligible && ( <FormField name="nodeId" label={t('pages.inbounds.deployTo')}> ``` 2. **Clone shows no target picker** — `frontend/src/pages/inbounds/InboundsPage.tsx:556`: the multi-target dialog only opens for `NODE_ELIGIBLE_PROTOCOLS[dbInbound.protocol]`; everything else takes the "original one-click local clone" branch. 3. **The API refuses it too**, so this is not just a hidden UI control — `internal/web/service/inbound.go:962`: ```go if inbound.NodeID != nil && !isNodeEligibleProtocol(inbound.Protocol) { return inbound, false, common.NewErrorf("%s inbounds cannot be assigned to a node", inbound.Protocol) } ``` (the same guard is repeated on update at `internal/web/service/inbound.go:1500`). The intent is stated in the source and pinned by a test, so this is not an oversight: ```go // internal/web/service/inbound_protocol.go:56 // nodeEligibleProtocols mirrors the frontend's NODE_ELIGIBLE_PROTOCOLS. The // sidecar-managed protocols are absent because their reconcile loops only query // NodeID IS NULL rows, so a node-assigned one would never be reconciled at all. ``` `TestIsNodeEligibleProtocol` (`internal/web/service/inbound_protocol_test.go:95`) asserts `model.AmneziaWG` is **ineligible**. The underlying constraint is real: the desired-state query for the embedded AmneziaWG runtime is local-only — `internal/web/service/inbound_amneziawg.go:31`, `Where("protocol = ? AND enable = ? AND node_id IS NULL", model.AmneziaWG, true)` — so a row with a `node_id` would never be reconciled by the master's `amneziawg_job`. **Workaround today** Create the AmneziaWG inbound directly in the sub-node's own panel UI, where it is a local inbound: every 3x-ui instance schedules the reconcile job unconditionally (`internal/web/web.go:338`, `awgJob := job.NewAmneziaWGJob()`), master or node. The trade-off is ownership — the master panel will not list that inbound, manage its clients, or aggregate its traffic. I read this from the code; I cannot run a panel here to demonstrate it. **Documentation is misleading here** and is worth correcting regardless of whether the restriction is lifted — `docs/content/docs/en/config/amneziawg.mdx:171` says multi-node paths "likely work (the reconciler runs the same way regardless of how the panel itself is deployed)", while the code hard-blocks node assignment. Verdict: Not a bug (expected behaviour) Severity: N/A Confidence: High Root cause: No defect. `amneziawg` is absent from `NODE_ELIGIBLE_PROTOCOLS` (`frontend/src/lib/xray/node-protocols.ts:9`) and from `nodeEligibleProtocols` (`internal/web/service/inbound_protocol.go:60`), which hides the Deploy To field (`InboundFormModal.tsx:617`), routes Clone to the local branch (`InboundsPage.tsx:556`) and makes the add/update API reject a node-assigned AmneziaWG inbound (`inbound.go:962`, `inbound.go:1500`). Both lists were introduced by the AmneziaWG feature commit itself, `effcccce feat(amneziawg): add native AmneziaWG protocol support (#6105)`. Already fixed: Not applicable — the restriction is present and deliberate on the default branch (`git tag --contains effcccce` → `v3.7.0`, the reporter's version). Duplicate of: None. Related: #6302 (AmneziaWG for outbounds) — different surface, not the same root cause. Evidence: `frontend/src/lib/xray/node-protocols.ts:9-16` (list without `amneziawg`); `frontend/src/pages/inbounds/form/InboundFormModal.tsx:252,617`; `frontend/src/pages/inbounds/InboundsPage.tsx:556-563`; `internal/web/service/inbound_protocol.go:56-67`; `internal/web/service/inbound.go:962-964` and `:1500-1502`; `internal/web/service/inbound_protocol_test.go:95-107` (`TestIsNodeEligibleProtocol`, ineligible set includes `model.AmneziaWG`); `internal/web/service/inbound_amneziawg.go:31` (`node_id IS NULL`); `internal/web/web.go:338-340` (job scheduled in every instance); `internal/util/wirecodec/wirecodec.go:18-22` (`zstd` is the only node capability token); `docs/content/docs/en/config/amneziawg.mdx:167-177`. Not determined: Whether lifting the restriction is wanted — a node push would go out via `Remote.AddInbound` (`internal/web/runtime/remote.go:412`) to the child panel's `/panel/api/inbounds/add`, where the row would be local and reconcilable, so the block may be conservative rather than structural. Only the maintainer can settle that; it is a design decision, not something the source answers. Note: the `bug` label and the `[Bug]:` title prefix are unchanged — the label and title edits this analysis would have made (swap `bug` → `enhancement`) were refused by this environment's permissions, so a maintainer needs to apply them by hand. *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
Author
Owner

@rlex commented on GitHub (Aug 24, 2026):

Will wait for Sanaei input then

<!-- gh-comment-id:5400990112 --> @rlex commented on GitHub (Aug 24, 2026): Will wait for Sanaei input then
Author
Owner

@rlex commented on GitHub (Sep 3, 2026):

Sorry for ping @MHSanaei but what do you think about it?

<!-- gh-comment-id:5532766615 --> @rlex commented on GitHub (Sep 3, 2026): Sorry for ping @MHSanaei but what do you think about it?
Author
Owner

@ChesterFishmansWork commented on GitHub (Oct 2, 2026):

Looked into what a fix would actually cost here, since the selector gate is only the visible part. Beyond adding amneziawg to nodeEligibleProtocols / NODE_ELIGIBLE_PROTOCOLS, two structural pieces have to move:

  1. Convergence. InboundService.DesiredAmneziaWGInstances selects protocol = amneziawg AND enable = 1 AND node_id IS NULL (internal/web/service/inbound_amneziawg.go:30), and the interface is materialised by the embedded sidecar (internal/amneziawg) on the panel that owns the row. A node-assigned AWG inbound is therefore invisible to every reconcile loop — the node's own panel would have to run the same sidecar for its own rows, with the master keeping metadata and pushing the inbound like the Xray protocols do today.
  2. Collision checks are panel-wide. The tunnel address book (ClientService.otherTunnelAllowedIPs, internal/web/service/client_inbound_apply.go:272) and the port checks (internal/web/service/port_conflict.go) look across all inbounds regardless of node_id. Two nodes may legitimately reuse the same subnet/port — they are separate hosts — but on a single node they must not, so those queries become node-scoped. wireInbound already ships settings verbatim, so the per-node push is mostly plumbing plus tests (inbound_protocol_test.go mirrors the frontend list).

So the shape of the patch is: extend both protocol lists, make the desired-state query node-aware, scope the AWG/WG subnet + port checks per node, mirror it in the tests.

Three decisions change the size of that patch, and I'd rather not guess them:

  • Does the node's own panel run the AWG sidecar (master = metadata + push, symmetric with the Xray protocols), or is the master supposed to drive interfaces on the node over the API?
  • Should the same AWG subnet/port be allowed on different nodes (node-scoped checks), or stay globally unique (much smaller patch, but "deploy the same template on every node" keeps failing)?
  • Node capability advertisement for AWG so an older node is rejected instead of silently never converging — same PR or follow-up?

If that direction is right I'm happy to prepare it as a PR.

<!-- gh-comment-id:5952423321 --> @ChesterFishmansWork commented on GitHub (Oct 2, 2026): Looked into what a fix would actually cost here, since the selector gate is only the visible part. Beyond adding `amneziawg` to `nodeEligibleProtocols` / `NODE_ELIGIBLE_PROTOCOLS`, two structural pieces have to move: 1. **Convergence.** `InboundService.DesiredAmneziaWGInstances` selects `protocol = amneziawg AND enable = 1 AND node_id IS NULL` (`internal/web/service/inbound_amneziawg.go:30`), and the interface is materialised by the embedded sidecar (`internal/amneziawg`) on the panel that owns the row. A node-assigned AWG inbound is therefore invisible to every reconcile loop — the node's own panel would have to run the same sidecar for its own rows, with the master keeping metadata and pushing the inbound like the Xray protocols do today. 2. **Collision checks are panel-wide.** The tunnel address book (`ClientService.otherTunnelAllowedIPs`, `internal/web/service/client_inbound_apply.go:272`) and the port checks (`internal/web/service/port_conflict.go`) look across all inbounds regardless of `node_id`. Two nodes may legitimately reuse the same subnet/port — they are separate hosts — but on a single node they must not, so those queries become node-scoped. `wireInbound` already ships `settings` verbatim, so the per-node push is mostly plumbing plus tests (`inbound_protocol_test.go` mirrors the frontend list). So the shape of the patch is: extend both protocol lists, make the desired-state query node-aware, scope the AWG/WG subnet + port checks per node, mirror it in the tests. Three decisions change the size of that patch, and I'd rather not guess them: * Does the node's **own panel** run the AWG sidecar (master = metadata + push, symmetric with the Xray protocols), or is the master supposed to drive interfaces on the node over the API? * Should the same AWG subnet/port be allowed on different nodes (node-scoped checks), or stay globally unique (much smaller patch, but "deploy the same template on every node" keeps failing)? * Node capability advertisement for AWG so an older node is rejected instead of silently never converging — same PR or follow-up? If that direction is right I'm happy to prepare it as a PR.
Author
Owner

@rlex commented on GitHub (Oct 2, 2026):

also affects TUIC

<!-- gh-comment-id:5952469664 --> @rlex commented on GitHub (Oct 2, 2026): also affects TUIC
Author
Owner

@ChesterFishmansWork commented on GitHub (Oct 2, 2026):

Re TUIC: same shape of problem, so it should be decided once rather than twice. TUIC (see #6704) is also materialised by state that lives on the panel owning the row, so enabling the protocol in the deploy path alone leaves a node-assigned TUIC inbound invisible to the reconcile loop — exactly the convergence piece described above.

If the direction is "the node's own panel runs the sidecar for its own rows and the master keeps metadata + pushes", AWG and TUIC can both be enabled on nodes in one series of changes; if instead the master drives the interfaces over the API, both need that API path. The two remaining questions (node-scoped vs globally unique subnet/port checks, and capability advertisement for older nodes) apply to both protocols unchanged.

So the plan above is meant to cover TUIC as well — happy to shape the PR around whichever direction the maintainers pick.

<!-- gh-comment-id:5953271784 --> @ChesterFishmansWork commented on GitHub (Oct 2, 2026): Re TUIC: same shape of problem, so it should be decided once rather than twice. TUIC (see #6704) is also materialised by state that lives on the panel owning the row, so enabling the protocol in the deploy path alone leaves a node-assigned TUIC inbound invisible to the reconcile loop — exactly the convergence piece described above. If the direction is "the node's own panel runs the sidecar for its own rows and the master keeps metadata + pushes", AWG and TUIC can both be enabled on nodes in one series of changes; if instead the master drives the interfaces over the API, both need that API path. The two remaining questions (node-scoped vs globally unique subnet/port checks, and capability advertisement for older nodes) apply to both protocols unchanged. So the plan above is meant to cover TUIC as well — happy to shape the PR around whichever direction the maintainers pick.
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#4281
No description provided.