[GH-ISSUE #5105] [Bug]: MTProto inbound doesn't export properly #3587

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

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

Describe the bug

After the creation of MTProto inbound, the remark chosen by user will get added to the end of the export URL, such as: tg://proxy?server=1.1.1.1&port=443&secret=xxx#remark
This format is not supported on Telegram Desktop, thus, leading to "This proxy link is invalid" error. Plus, it is mainly useless for now as across multiple Telegram clients, adding remarks is meaningless and unsupported.

How to reproduce the problem

  1. Open inbounds page
  2. Create a MTProto inbound
  3. Add remark
  4. On export, the remark gets added at the end of the export URL
  5. Fail to one-click-import in Telegram Desktop

Expected behavior

The remark should not be added at the end of export URL as it is meaningless across different Telegram clients.

Actual behavior

The remark gets added at the end of export URL.

Relevant logs


Screenshots

No response

3x-ui version

3.3.0

Xray-core version

No response

How did you install 3x-ui?

install.sh script

Operating system

Ubuntu

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 @femdiya on GitHub (Jun 9, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5105 ### Describe the bug After the creation of MTProto inbound, the remark chosen by user will get added to the end of the export URL, such as: tg://proxy?server=1.1.1.1&port=443&secret=xxx#remark This format is not supported on Telegram Desktop, thus, leading to "This proxy link is invalid" error. Plus, it is mainly useless for now as across multiple Telegram clients, adding remarks is meaningless and unsupported. ### How to reproduce the problem 1. Open inbounds page 2. Create a MTProto inbound 3. Add remark 4. On export, the remark gets added at the end of the export URL 5. Fail to one-click-import in Telegram Desktop ### Expected behavior The remark should not be added at the end of export URL as it is meaningless across different Telegram clients. ### Actual behavior The remark gets added at the end of export URL. ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.3.0 ### Xray-core version _No response_ ### How did you install 3x-ui? install.sh script ### Operating system Ubuntu ### 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:33:31 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

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

Thanks for the clear report. This is a confirmed bug in the current codebase (v3.3.0).

Root cause

The remark is being appended as a URL fragment (after #) to the tg://proxy deep link in two places:

  1. Frontend — frontend/src/lib/xray/inbound-link.ts line 701:
url.hash = encodeURIComponent(remark);

This produces: tg://proxy?server=...&port=...&secret=...#YourRemark

  1. Backend subscription service — sub/subService.go line 406:
return buildLinkWithParams("tg://proxy", params, s.genRemark(inbound, email, ""))

The third argument to buildLinkWithParams is the fragment; it ends up appended as #remark via appendQueryAndFragment (lines 1392–1396 of the same file).

The tg://proxy URL scheme does not define a #fragment component. Telegram Desktop rejects any such URL with the error you saw.

The fix is to pass an empty string as the fragment for MTProto links in both locations — simply omit the remark from the exported URL. No other protocol is affected; for VLESS, VMess, Trojan, Shadowsocks, etc., the #remark convention is well-supported. MTProto is the only outlier.

<!-- gh-comment-id:4654720926 --> @github-actions[bot] commented on GitHub (Jun 9, 2026): Thanks for the clear report. This is a confirmed bug in the current codebase (v3.3.0). **Root cause** The remark is being appended as a URL fragment (after `#`) to the `tg://proxy` deep link in **two places**: 1. **Frontend** — `frontend/src/lib/xray/inbound-link.ts` line 701: ```typescript url.hash = encodeURIComponent(remark); ``` This produces: `tg://proxy?server=...&port=...&secret=...#YourRemark` 2. **Backend subscription service** — `sub/subService.go` line 406: ```go return buildLinkWithParams("tg://proxy", params, s.genRemark(inbound, email, "")) ``` The third argument to `buildLinkWithParams` is the fragment; it ends up appended as `#remark` via `appendQueryAndFragment` (lines 1392–1396 of the same file). The `tg://proxy` URL scheme does not define a `#fragment` component. Telegram Desktop rejects any such URL with the error you saw. **The fix** is to pass an empty string as the fragment for MTProto links in both locations — simply omit the remark from the exported URL. No other protocol is affected; for VLESS, VMess, Trojan, Shadowsocks, etc., the `#remark` convention is well-supported. MTProto is the only outlier.
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#3587
No description provided.