[GH-ISSUE #5565] [Bug]: Failed to connect using fragments #3885

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

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

Describe the bug

config error: infra/conf/serial: failed to parse json config > infra/conf: failed to build outbound config with tag proxy > infra/conf: failed to build stream settings for outbound detour > infra/conf: failed to build mask with type fragment > infra/conf: LengthMin cant be 0

How to reproduce the problem

Use xhttp+vless+tls with tcp fragments

Expected behavior

No response

Actual behavior

No response

Relevant logs


Screenshots

No response

3x-ui version

3.4.0

Xray-core version

26.6.1

How did you install 3x-ui?

Docker / Docker Compose

Operating system

Ubuntu 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

  • 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 @andyplop9 on GitHub (Jun 25, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5565 ### Describe the bug config error: infra/conf/serial: failed to parse json config > infra/conf: failed to build outbound config with tag proxy > infra/conf: failed to build stream settings for outbound detour > infra/conf: failed to build mask with type fragment > infra/conf: LengthMin cant be 0 ### How to reproduce the problem Use xhttp+vless+tls with tcp fragments ### Expected behavior _No response_ ### Actual behavior _No response_ ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.4.0 ### Xray-core version 26.6.1 ### How did you install 3x-ui? Docker / Docker Compose ### Operating system Ubuntu 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 - [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:38 +07:00
Author
Owner

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

The error originates from xray-core's fragment mask validator on the client side: the outbound tagged `proxy` in the subscription JSON config (generated by the panel — source confirmed in `internal/sub/json_service.go:387`) has a fragment mask whose `LengthMin` is 0 or absent. xray-core rejects any fragment mask where `LengthMin` is not a positive integer; this is also documented in the panel's own frontend validator at `frontend/src/lib/xray/forms/transport/FinalMaskForm.tsx:382`.

Why this happens in 3.4.0

v3.4.0 introduced per-segment `lengths`/`delays` arrays for fragment masks (following xray-core #6334, commit `852b53db`), replacing the single `length` string field. A migration runs automatically when you open the inbound edit form — but only in the browser. If the inbound was previously saved with `length: ""` (empty) or with any value whose minimum parses to 0, the migration removes the old `length` key but produces no `lengths` array, leaving the stored fragment settings with no length field at all. The subscription JSON generator (`internal/sub/json_service.go`) passes the stored `finalmask` through to the client config without re-validating it, so the client receives a fragment mask that xray-core cannot build.

Immediate fix

  1. Open the panel and edit the affected inbound.
  2. Under Stream Settings → TCP Masks, find the fragment mask.
  3. Ensure the Lengths list has at least one entry in `min-max` format where `min > 0` (e.g. `100-200`). An empty list, a blank entry, or a value like `0-200` will all trigger this error.
  4. Save the inbound. The panel now enforces the constraint via form validation.
  5. Restart xray-core from the panel or run `x-ui restart` on the server.

If you have a global subscription finalmask configured (panel Settings → Subscription → Sub JSON Finalmask), check it for the same issue.

Information needed to confirm the root cause

  1. The full, untruncated xray-core log line (the error is cut off after `LengthMin cant be`).
  2. The current fragment mask settings stored in the inbound: specifically the `packets`, `lengths` (or legacy `length`), `delays` (or `delay`), and `maxSplit` values — you can find them by exporting the inbound config from the panel.
  3. Whether the inbound was created fresh in 3.4.0 or carried over from an older version of the panel.

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

<!-- gh-comment-id:4801024693 --> @github-actions[bot] commented on GitHub (Jun 25, 2026): The error originates from xray-core's fragment mask validator on the **client** side: the outbound tagged \`proxy\` in the subscription JSON config (generated by the panel — source confirmed in \`internal/sub/json_service.go:387\`) has a fragment mask whose \`LengthMin\` is 0 or absent. xray-core rejects any fragment mask where \`LengthMin\` is not a positive integer; this is also documented in the panel's own frontend validator at \`frontend/src/lib/xray/forms/transport/FinalMaskForm.tsx:382\`. **Why this happens in 3.4.0** v3.4.0 introduced per-segment \`lengths\`/\`delays\` arrays for fragment masks (following xray-core #6334, commit \`852b53db\`), replacing the single \`length\` string field. A migration runs automatically when you open the inbound edit form — but only in the browser. If the inbound was previously saved with \`length: ""\` (empty) or with any value whose minimum parses to 0, the migration removes the old \`length\` key but produces no \`lengths\` array, leaving the stored fragment settings with no length field at all. The subscription JSON generator (\`internal/sub/json_service.go\`) passes the stored \`finalmask\` through to the client config without re-validating it, so the client receives a fragment mask that xray-core cannot build. **Immediate fix** 1. Open the panel and edit the affected inbound. 2. Under **Stream Settings → TCP Masks**, find the fragment mask. 3. Ensure the **Lengths** list has at least one entry in \`min-max\` format where \`min > 0\` (e.g. \`100-200\`). An empty list, a blank entry, or a value like \`0-200\` will all trigger this error. 4. Save the inbound. The panel now enforces the constraint via form validation. 5. Restart xray-core from the panel or run \`x-ui restart\` on the server. If you have a global subscription finalmask configured (panel **Settings → Subscription → Sub JSON Finalmask**), check it for the same issue. **Information needed to confirm the root cause** 1. The full, untruncated xray-core log line (the error is cut off after \`LengthMin cant be\`). 2. The current fragment mask settings stored in the inbound: specifically the \`packets\`, \`lengths\` (or legacy \`length\`), \`delays\` (or \`delay\`), and \`maxSplit\` values — you can find them by exporting the inbound config from the panel. 3. Whether the inbound was created fresh in 3.4.0 or carried over from an older version of the panel. _This reply was generated automatically; a maintainer may follow up._
Author
Owner

@andyplop9 commented on GitHub (Jun 25, 2026):

I use this setting btw

"streamSettings": {
"finalmask": {
"tcp": [
{
"settings": {
"delays": [
"1"
],
"lengths": [
"1"
],
"maxSplit": "1500",
"packets": "1-1"
},
"type": "fragment"
}
]

<!-- gh-comment-id:4801130333 --> @andyplop9 commented on GitHub (Jun 25, 2026): I use this setting btw "streamSettings": { "finalmask": { "tcp": [ { "settings": { "delays": [ "1" ], "lengths": [ "1" ], "maxSplit": "1500", "packets": "1-1" }, "type": "fragment" } ]
Author
Owner

@andyplop9 commented on GitHub (Jun 25, 2026):

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" }

<!-- gh-comment-id:4801384470 --> @andyplop9 commented on GitHub (Jun 25, 2026): 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" }`
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#3885
No description provided.