[GH-ISSUE #5568] finalmask fragment subscription config generates invalid array fields "lengths"/"delays" instead of string fields "length"/"delay" #3887

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

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

When exporting a client config through the subscription system with finalmask + fragment enabled, 3X-UI generates incorrect field names and types for the fragment settings. This bug did not exist in previous versions of 3X-UI — the exported config used to be valid and loaded correctly in Xray clients.

Xray-core Source Proof
According to the official Xray-core source at:
https://github.com/XTLS/Xray-core/blob/main/infra/conf/transport_internet.go
The FragmentMask struct is defined as:
type FragmentMask struct { Packets string json:"packets"Length Int32Rangejson:"length"Delay Int32Rangejson:"delay"MaxSplit Int32Rangejson:"maxSplit" }

Fields are singular strings with range values — not arrays.

What 3X-UI Currently Generates (Broken):
"settings": { "delays": ["1"], "lengths": ["1"], "maxSplit": "1500", "packets": "1-1" }

Originally posted by @andyplop9 in #5565

Originally created by @andyplop9 on GitHub (Jun 25, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5568 > When exporting a client config through the subscription system with finalmask + fragment enabled, 3X-UI generates incorrect field names and types for the fragment settings. This bug did not exist in previous versions of 3X-UI — the exported config used to be valid and loaded correctly in Xray clients. > > Xray-core Source Proof > According to the official Xray-core source at: > https://github.com/XTLS/Xray-core/blob/main/infra/conf/transport_internet.go > The FragmentMask struct is defined as: > `type FragmentMask struct { > Packets string `json:"packets"` > Length Int32Range `json:"length"` > Delay Int32Range `json:"delay"` > MaxSplit Int32Range `json:"maxSplit"` > }` > > Fields are singular strings with range values — not arrays. > > > What 3X-UI Currently Generates (Broken): > `"settings": { > "delays": ["1"], > "lengths": ["1"], > "maxSplit": "1500", > "packets": "1-1" > }` _Originally posted by @andyplop9 in [#5565](https://github.com/MHSanaei/3x-ui/issues/5565#issuecomment-4801384470)_
bsakaguchi 2026-10-31 20:35:40 +07:00
  • closed this issue
  • added the
    question
    label
Author
Owner

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

The lengths/delays array format in the generated subscription config is intentional and correct for the xray-core version that ships with 3x-ui v3.4.0. The xray-core source you quoted predates the change that introduced these fields.

What changed and why

xray-core PR XTLS/Xray-core#6334 — titled "Fragment finalmask: Add `lengths` and `delays`" — was merged on 2026-06-22. It replaced the single-range length/delay strings with per-segment arrays so each fragment segment can carry its own length and delay:

{
  "type": "fragment",
  "settings": {
    "packets": "tlshello",
    "lengths": ["3-5", "6-8", "10-20"],
    "delays": ["1-2", "5-6", "10-20"]
  }
}

The old singular length/delay keys remain as a backward-compatibility fallback inside xray-core itself, but they are no longer what the new API emits.

3x-ui v3.4.0 adopted this format in commit 852b53db ("feat(xray): add loopback sniffing and per-segment fragment masks — support per-segment lengths/delays arrays with legacy length/delay migration (xray-core #6334)"). The frontend also contains migrateFragmentSettings() (confirmed in frontend/src/lib/xray/forms/transport/FinalMaskForm.tsx) to silently convert any old length/delay keys to the new arrays when the form is opened.

The subscription JSON service (internal/sub/json_service.go) passes the stored finalmask data through to the exported config without transformation, so whatever is saved in the panel is what the subscriber receives.

The actual compatibility problem

The error reported in the related #5565 — infra/conf: LengthMin cant be 0 — is the symptom of this mismatch:

  • A client application (v2rayN, NekoRay, or any other xray-based client) that bundles xray-core built before 2026-06-22 does not recognise lengths/delays. It silently ignores them.
  • Because length is absent, xray-core falls back to length = 0, which is rejected at config load time with "LengthMin cant be 0".

This is not a bug in the generated config. It is a client-side version compatibility issue: the subscription requires the client to run xray-core >= v26.6.22 (the release that includes PR #6334).

Workaround until your client app ships an updated xray-core

In the panel, remove the fragment finalmask from the subscription settings entirely and configure the fragment mask directly in your client application using whatever format your client's xray-core version understands. The server itself is unaffected.

If you control the client and can update it, installing xray-core >= v26.6.22 on the client side will make the subscription work without any panel changes.

Information that would help if you believe something else is happening

  1. Which client application (name and version) is loading the subscription and producing the error.
  2. The xray-core version bundled in that client application.
  3. Whether you are seeing the error on the server side (in 3x-ui's own xray process) or on the client side.

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

<!-- gh-comment-id:4801472534 --> @github-actions[bot] commented on GitHub (Jun 25, 2026): The `lengths`/`delays` array format in the generated subscription config is intentional and correct for the xray-core version that ships with 3x-ui v3.4.0. The xray-core source you quoted predates the change that introduced these fields. **What changed and why** xray-core PR [XTLS/Xray-core#6334](https://github.com/XTLS/Xray-core/pull/6334) — titled "Fragment finalmask: Add \`lengths\` and \`delays\`" — was merged on 2026-06-22. It replaced the single-range `length`/`delay` strings with per-segment arrays so each fragment segment can carry its own length and delay: ```json { "type": "fragment", "settings": { "packets": "tlshello", "lengths": ["3-5", "6-8", "10-20"], "delays": ["1-2", "5-6", "10-20"] } } ``` The old singular `length`/`delay` keys remain as a backward-compatibility fallback inside xray-core itself, but they are no longer what the new API emits. 3x-ui v3.4.0 adopted this format in commit `852b53db` ("feat(xray): add loopback sniffing and per-segment fragment masks — support per-segment lengths/delays arrays with legacy length/delay migration (xray-core #6334)"). The frontend also contains `migrateFragmentSettings()` (confirmed in `frontend/src/lib/xray/forms/transport/FinalMaskForm.tsx`) to silently convert any old `length`/`delay` keys to the new arrays when the form is opened. The subscription JSON service (`internal/sub/json_service.go`) passes the stored `finalmask` data through to the exported config without transformation, so whatever is saved in the panel is what the subscriber receives. **The actual compatibility problem** The error reported in the related #5565 — `infra/conf: LengthMin cant be 0` — is the symptom of this mismatch: - A **client application** (v2rayN, NekoRay, or any other xray-based client) that bundles xray-core built **before 2026-06-22** does not recognise `lengths`/`delays`. It silently ignores them. - Because `length` is absent, xray-core falls back to `length = 0`, which is rejected at config load time with "LengthMin cant be 0". This is not a bug in the generated config. It is a **client-side version compatibility issue**: the subscription requires the client to run xray-core >= v26.6.22 (the release that includes PR #6334). **Workaround until your client app ships an updated xray-core** In the panel, remove the fragment finalmask from the subscription settings entirely and configure the fragment mask directly in your client application using whatever format your client's xray-core version understands. The server itself is unaffected. If you control the client and can update it, installing xray-core >= v26.6.22 on the client side will make the subscription work without any panel changes. **Information that would help if you believe something else is happening** 1. Which client application (name and version) is loading the subscription and producing the error. 2. The xray-core version bundled in that client application. 3. Whether you are seeing the error on the server side (in 3x-ui's own xray process) or on the client side. --- *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#3887
No description provided.