[GH-ISSUE #4781] [Bug]: WARP outbound generated without Cloudflare reserved bytes #3318

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

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

Describe the bug

When creating a WARP outbound from a clean 3x-ui installation, the generated Xray WireGuard outbound is saved with an empty settings.reserved array and no peer reserved value:

"reserved": [],
"peerReserved": null

For Cloudflare WARP, the generated profile normally includes 3 reserved bytes / client id. Xray WireGuard outbound supports the reserved field, and WARP profiles generated by other tools usually provide 3 decimal reserved bytes.

The outbound may still appear to work in some cases, but the generated Cloudflare WARP profile looks incomplete.

How to reproduce the problem

  1. Install clean 3x-ui using the official install.sh script.
  2. Open the 3x-ui panel.
  3. Go to Xray Settings -> Outbounds.
  4. Click WARP / Create.
  5. Click Add outbound.
  6. Save the Xray settings.
  7. Inspect the saved xrayTemplateConfig in the SQLite database.

Safe diagnostic command, without printing private keys:

sudo sqlite3 /etc/x-ui/x-ui.db "SELECT value FROM settings WHERE key='xrayTemplateConfig';" \
| jq '.outbounds[] | select(.protocol=="wireguard" or .tag=="warp") | {
  tag,
  protocol,
  reserved: .settings.reserved,
  peerReserved: .settings.peers[0].reserved,
  endpoint: .settings.peers[0].endpoint,
  mtu: .settings.mtu,
  workers: .settings.workers,
  domainStrategy: .settings.domainStrategy,
  noKernelTun: .settings.noKernelTun
}'

Expected behavior

For a Cloudflare WARP outbound, the generated WireGuard settings should include valid reserved bytes, for example:

"reserved": [123, 45, 67]

The exact values must come from the generated WARP registration/profile and should not be hardcoded.

Actual behavior

On a clean 3x-ui installation, after creating WARP from the panel, the saved outbound is:

{
  "tag": "warp",
  "protocol": "wireguard",
  "reserved": [],
  "peerReserved": null,
  "endpoint": "engage.cloudflareclient.com:2408",
  "mtu": 1420,
  "workers": null,
  "domainStrategy": "ForceIP",
  "noKernelTun": false
}

So the WARP outbound is created without Cloudflare reserved bytes.

Relevant logs

No private keys, UUIDs, passwords, tokens or real domains are included.

Safe diagnostic command used:


sudo sqlite3 /etc/x-ui/x-ui.db "SELECT value FROM settings WHERE key='xrayTemplateConfig';" \
| jq '.outbounds[] | select(.protocol=="wireguard" or .tag=="warp") | {
  tag,
  protocol,
  reserved: .settings.reserved,
  peerReserved: .settings.peers[0].reserved,
  endpoint: .settings.peers[0].endpoint,
  mtu: .settings.mtu,
  workers: .settings.workers,
  domainStrategy: .settings.domainStrategy,
  noKernelTun: .settings.noKernelTun
}'


Output:


{
  "tag": "warp",
  "protocol": "wireguard",
  "reserved": [],
  "peerReserved": null,
  "endpoint": "engage.cloudflareclient.com:2408",
  "mtu": 1420,
  "workers": null,
  "domainStrategy": "ForceIP",
  "noKernelTun": false
}

Screenshots

Not needed. The sanitized SQLite/Xray template output above is enough to reproduce the issue.

3x-ui version

3.2.5

Xray-core version

26.6.1

How did you install 3x-ui?

install.sh script

Operating system

Ubuntu 24.04 / Debian 12

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?

No — direct access

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 @deepru on GitHub (Jun 1, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/4781 ### Describe the bug When creating a WARP outbound from a clean 3x-ui installation, the generated Xray WireGuard outbound is saved with an empty `settings.reserved` array and no peer reserved value: ```json "reserved": [], "peerReserved": null ``` For Cloudflare WARP, the generated profile normally includes 3 reserved bytes / client id. Xray WireGuard outbound supports the `reserved` field, and WARP profiles generated by other tools usually provide 3 decimal reserved bytes. The outbound may still appear to work in some cases, but the generated Cloudflare WARP profile looks incomplete. ### How to reproduce the problem 1. Install clean 3x-ui using the official `install.sh` script. 2. Open the 3x-ui panel. 3. Go to `Xray Settings` -> `Outbounds`. 4. Click `WARP` / `Create`. 5. Click `Add outbound`. 6. Save the Xray settings. 7. Inspect the saved `xrayTemplateConfig` in the SQLite database. Safe diagnostic command, without printing private keys: ```bash sudo sqlite3 /etc/x-ui/x-ui.db "SELECT value FROM settings WHERE key='xrayTemplateConfig';" \ | jq '.outbounds[] | select(.protocol=="wireguard" or .tag=="warp") | { tag, protocol, reserved: .settings.reserved, peerReserved: .settings.peers[0].reserved, endpoint: .settings.peers[0].endpoint, mtu: .settings.mtu, workers: .settings.workers, domainStrategy: .settings.domainStrategy, noKernelTun: .settings.noKernelTun }' ``` ### Expected behavior For a Cloudflare WARP outbound, the generated WireGuard settings should include valid reserved bytes, for example: ```json "reserved": [123, 45, 67] ``` The exact values must come from the generated WARP registration/profile and should not be hardcoded. ### Actual behavior On a clean 3x-ui installation, after creating WARP from the panel, the saved outbound is: ```json { "tag": "warp", "protocol": "wireguard", "reserved": [], "peerReserved": null, "endpoint": "engage.cloudflareclient.com:2408", "mtu": 1420, "workers": null, "domainStrategy": "ForceIP", "noKernelTun": false } ``` So the WARP outbound is created without Cloudflare reserved bytes. ### Relevant logs ```shell No private keys, UUIDs, passwords, tokens or real domains are included. Safe diagnostic command used: sudo sqlite3 /etc/x-ui/x-ui.db "SELECT value FROM settings WHERE key='xrayTemplateConfig';" \ | jq '.outbounds[] | select(.protocol=="wireguard" or .tag=="warp") | { tag, protocol, reserved: .settings.reserved, peerReserved: .settings.peers[0].reserved, endpoint: .settings.peers[0].endpoint, mtu: .settings.mtu, workers: .settings.workers, domainStrategy: .settings.domainStrategy, noKernelTun: .settings.noKernelTun }' Output: { "tag": "warp", "protocol": "wireguard", "reserved": [], "peerReserved": null, "endpoint": "engage.cloudflareclient.com:2408", "mtu": 1420, "workers": null, "domainStrategy": "ForceIP", "noKernelTun": false } ``` ### Screenshots Not needed. The sanitized SQLite/Xray template output above is enough to reproduce the issue. ### 3x-ui version 3.2.5 ### Xray-core version 26.6.1 ### How did you install 3x-ui? install.sh script ### Operating system Ubuntu 24.04 / Debian 12 ### 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? No — direct access ### 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:35 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

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

Thanks for the detailed and well-reproduced report!

This is a confirmed bug in the backend. The root cause is in web/service/warp.go — the RegWarp function extracts id, token, and account.license from the Cloudflare registration response, but does not extract client_id (which lives at config.client_id in the response). As a result, the client_id is never stored in the database.

On the frontend side (WarpModal.tsx), the logic is actually correct: reservedFor(data?.client_id) decodes the base64 client_id into 3 decimal bytes and passes them as reserved. But since client_id is never populated in the stored warpData, the value is always undefined, and reservedFor returns [].

Fix needed in web/service/warp.go → RegWarp:

Extract client_id from the registration response (path: rsp["config"].(map[string]any)["client_id"]) and include it in the warpData map before saving to the database. The same fix should also be applied to GetWarpConfig so that fetching an existing registration also returns the client_id.

Workaround (manual): You can patch the reserved bytes directly in the SQLite database or via the panel's outbound editor after identifying your client_id from the Cloudflare API response. Other WARP tooling (e.g., warp-reg) can generate a fresh registration that includes the client_id.

A pull request fixing warp.go to persist and return client_id would be very welcome here.

<!-- gh-comment-id:4595848683 --> @github-actions[bot] commented on GitHub (Jun 1, 2026): Thanks for the detailed and well-reproduced report\! This is a confirmed bug in the backend. The root cause is in `web/service/warp.go` — the `RegWarp` function extracts `id`, `token`, and `account.license` from the Cloudflare registration response, but **does not extract `client_id`** (which lives at `config.client_id` in the response). As a result, the `client_id` is never stored in the database. On the frontend side (`WarpModal.tsx`), the logic is actually correct: `reservedFor(data?.client_id)` decodes the base64 `client_id` into 3 decimal bytes and passes them as `reserved`. But since `client_id` is never populated in the stored `warpData`, the value is always `undefined`, and `reservedFor` returns `[]`. **Fix needed in `web/service/warp.go` → `RegWarp`:** Extract `client_id` from the registration response (path: `rsp["config"].(map[string]any)["client_id"]`) and include it in the `warpData` map before saving to the database. The same fix should also be applied to `GetWarpConfig` so that fetching an existing registration also returns the `client_id`. **Workaround (manual):** You can patch the reserved bytes directly in the SQLite database or via the panel's outbound editor after identifying your `client_id` from the Cloudflare API response. Other WARP tooling (e.g., `warp-reg`) can generate a fresh registration that includes the `client_id`. A pull request fixing `warp.go` to persist and return `client_id` would be very welcome here.
Author
Owner

@deepru commented on GitHub (Jun 1, 2026):

Thanks for confirming and for the clear root-cause explanation.

That matches what I observed: the frontend-side reservedFor(data?.client_id) logic makes sense, but the saved/generated WARP data does not contain client_id, so the resulting reserved bytes become an empty array.

I will avoid manually patching generated reserved bytes in my tooling and will just preserve them when present / warn when missing until upstream persists and returns client_id correctly.

Thanks again.

<!-- gh-comment-id:4595893837 --> @deepru commented on GitHub (Jun 1, 2026): Thanks for confirming and for the clear root-cause explanation. That matches what I observed: the frontend-side `reservedFor(data?.client_id)` logic makes sense, but the saved/generated WARP data does not contain `client_id`, so the resulting reserved bytes become an empty array. I will avoid manually patching generated reserved bytes in my tooling and will just preserve them when present / warn when missing until upstream persists and returns `client_id` correctly. Thanks again.
Author
Owner

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

Fixed. RegWarp now persists config.client_id from the Cloudflare registration response, and WarpModal sources the reserved bytes from the live config response (config.client_id) with a fallback to the stored credentials. This heals both new and already-registered installs without re-registration, so the generated WARP outbound now includes the correct 3 reserved bytes instead of [].

<!-- gh-comment-id:4596574150 --> @MHSanaei commented on GitHub (Jun 1, 2026): Fixed. `RegWarp` now persists `config.client_id` from the Cloudflare registration response, and `WarpModal` sources the reserved bytes from the live config response (`config.client_id`) with a fallback to the stored credentials. This heals both new and already-registered installs without re-registration, so the generated WARP outbound now includes the correct 3 reserved bytes instead of `[]`.
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#3318
No description provided.