[GH-ISSUE #5266] [Bug]: No UI to clear tgBotProxy after panelProxy removal in v3.3.1 — Telegram bot fails when SOCKS5 is disabled #3688

Closed
opened 2026-10-31 20:34:15 +07:00 by bsakaguchi · 2 comments
Owner

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

Describe the bug

After upgrading to v3.3.1, the Telegram bot stops working when the local SOCKS5 proxy is taken offline — even with panelOutbound configured and enabled.
The root cause: v3.3.1 removed the Panel Proxy URL field from the UI, but the old value persists in the database under tgBotProxy. There is now no way to clear it through the interface. The bot reads tgBotProxy directly (via GetTgBotProxy() in tgbot.go) and dials the stale SOCKS5 address — panelOutbound is not considered by the bot at all.
SELECT key, value FROM settings
WHERE key IN ('panelProxy', 'tgBotProxy', 'panelOutbound');
panelProxy | socks5://127.0.0.1:9051 ← stale, not cleaned up by migration
tgBotProxy | socks5://127.0.0.1:9051 ← bot still uses this; no UI to clear it
panelOutbound | ← set, but not used by the bot

How to reproduce the problem

Before upgrading: set Panel Proxy URL = socks5://127.0.0.1:9051 and Telegram Bot Proxy = socks5://127.0.0.1:9051.
Upgrade to v3.3.1.
Configure panelOutbound in Settings → Outbound tab.
Disable the local SOCKS5 proxy on the server.
Observe: Telegram bot stops responding.

Expected behavior

Migration to v3.3.1 should clear tgBotProxy and panelProxy if Panel Proxy URL was removed from the UI.
Either: the bot should route through panelOutbound, or a dedicated Telegram Bot Proxy field should remain in the Settings UI so users can clear it manually.

Actual behavior

"Telegram bot stops responding immediately after SOCKS5 proxy is disabled. No errors in the panel UI — the bot simply goes offline."
No response

Relevant logs


Screenshots

Image

3x-ui version

3.3.1

Xray-core version

26.6.1

How did you install 3x-ui?

install.sh script

Operating system

Ubuntu 22.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 @SergioSHA1 on GitHub (Jun 13, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5266 ### Describe the bug After upgrading to v3.3.1, the Telegram bot stops working when the local SOCKS5 proxy is taken offline — even with panelOutbound configured and enabled. The root cause: v3.3.1 removed the Panel Proxy URL field from the UI, but the old value persists in the database under tgBotProxy. There is now no way to clear it through the interface. The bot reads tgBotProxy directly (via GetTgBotProxy() in tgbot.go) and dials the stale SOCKS5 address — panelOutbound is not considered by the bot at all. SELECT key, value FROM settings WHERE key IN ('panelProxy', 'tgBotProxy', 'panelOutbound'); panelProxy | socks5://127.0.0.1:9051 ← stale, not cleaned up by migration tgBotProxy | socks5://127.0.0.1:9051 ← bot still uses this; no UI to clear it panelOutbound | <configured tag> ← set, but not used by the bot ### How to reproduce the problem Before upgrading: set Panel Proxy URL = socks5://127.0.0.1:9051 and Telegram Bot Proxy = socks5://127.0.0.1:9051. Upgrade to v3.3.1. Configure panelOutbound in Settings → Outbound tab. Disable the local SOCKS5 proxy on the server. Observe: Telegram bot stops responding. ### Expected behavior Migration to v3.3.1 should clear tgBotProxy and panelProxy if Panel Proxy URL was removed from the UI. Either: the bot should route through panelOutbound, or a dedicated Telegram Bot Proxy field should remain in the Settings UI so users can clear it manually. ### Actual behavior "Telegram bot stops responding immediately after SOCKS5 proxy is disabled. No errors in the panel UI — the bot simply goes offline." _No response_ ### Relevant logs ```shell ``` ### Screenshots <img width="323" height="424" alt="Image" src="https://github.com/user-attachments/assets/3cd4042a-7c7a-46db-9bef-59c679485103" /> ### 3x-ui version 3.3.1 ### Xray-core version 26.6.1 ### How did you install 3x-ui? install.sh script ### Operating system Ubuntu 22.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:34:15 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

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

The bug is confirmed against the v3.3.1 source. Here is exactly what is happening and how to recover.

What changed across versions

Version Panel proxy setting Bot proxy setting
≤ v3.2.5 — tgBotProxy field in Telegram settings tab
v3.2.6–v3.3.0 panelProxy text field in General settings tgBotProxy field removed; bot fell back to panelProxy
v3.3.1 Both removed; replaced by panelOutbound (Xray outbound tag picker) no dedicated bot proxy field

What the bot does now (confirmed in internal/web/service/tgbot/tgbot.go:232–244)

  1. Reads tgBotProxy from the database via GetTgBotProxy().
  2. Only if tgBotProxy is empty, falls back to PanelEgressProxyURL(), which resolves the loopback SOCKS5 bridge that the panel injects into Xray when panelOutbound is configured.

Because your database still contains tgBotProxy = socks5://127.0.0.1:9051 (set before the upgrade), step 2 is never reached. The bot dials the dead address. Your panelOutbound setting is valid but is bypassed while that stale value is present.

Why the value was not cleared on upgrade

There is no migration step in internal/database/db.go (runSeeders) that clears tgBotProxy or panelProxy when upgrading to v3.3.1. Both keys are left as-is in the database. panelProxy is now a dead key — no code in the current backend reads it (entity.AllSetting has no panelProxy field and internal/web/service/setting.go has no GetPanelProxy function).

Immediate workaround

Clear the stale value directly in the database, then restart the panel:

sqlite3 /etc/x-ui/x-ui.db "UPDATE settings SET value = '' WHERE key IN ('tgBotProxy', 'panelProxy');"
systemctl restart x-ui

After the restart, GetTgBotProxy() returns "", the fallback to PanelEgressProxyURL() fires, and the bot routes through the loopback SOCKS5 bridge for your configured panelOutbound tag. Ensure Xray is running at that point; if it is not, PanelEgressProxyURL() logs a warning and falls back to a direct connection until the next bot restart.

Proper fix

A one-time migration seeder in internal/database/db.go (runSeeders) that clears tgBotProxy and panelProxy on the first run after upgrade would prevent this for all existing users. Separately, restoring a tgBotProxy input in frontend/src/pages/settings/TelegramTab.tsx — even blank on fresh installs — would let users clear or override the proxy from the UI without touching the database directly.

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

<!-- gh-comment-id:4698031567 --> @github-actions[bot] commented on GitHub (Jun 13, 2026): The bug is confirmed against the v3.3.1 source. Here is exactly what is happening and how to recover. **What changed across versions** | Version | Panel proxy setting | Bot proxy setting | |---------|--------------------|--------------------| | ≤ v3.2.5 | — | `tgBotProxy` field in Telegram settings tab | | v3.2.6–v3.3.0 | `panelProxy` text field in General settings | `tgBotProxy` field removed; bot fell back to `panelProxy` | | v3.3.1 | Both removed; replaced by `panelOutbound` (Xray outbound tag picker) | no dedicated bot proxy field | **What the bot does now (confirmed in `internal/web/service/tgbot/tgbot.go:232–244`)** 1. Reads `tgBotProxy` from the database via `GetTgBotProxy()`. 2. **Only if `tgBotProxy` is empty**, falls back to `PanelEgressProxyURL()`, which resolves the loopback SOCKS5 bridge that the panel injects into Xray when `panelOutbound` is configured. Because your database still contains `tgBotProxy = socks5://127.0.0.1:9051` (set before the upgrade), step 2 is never reached. The bot dials the dead address. Your `panelOutbound` setting is valid but is bypassed while that stale value is present. **Why the value was not cleared on upgrade** There is no migration step in `internal/database/db.go` (`runSeeders`) that clears `tgBotProxy` or `panelProxy` when upgrading to v3.3.1. Both keys are left as-is in the database. `panelProxy` is now a dead key — no code in the current backend reads it (`entity.AllSetting` has no `panelProxy` field and `internal/web/service/setting.go` has no `GetPanelProxy` function). **Immediate workaround** Clear the stale value directly in the database, then restart the panel: ```bash sqlite3 /etc/x-ui/x-ui.db "UPDATE settings SET value = '' WHERE key IN ('tgBotProxy', 'panelProxy');" systemctl restart x-ui ``` After the restart, `GetTgBotProxy()` returns `""`, the fallback to `PanelEgressProxyURL()` fires, and the bot routes through the loopback SOCKS5 bridge for your configured `panelOutbound` tag. Ensure Xray is running at that point; if it is not, `PanelEgressProxyURL()` logs a warning and falls back to a direct connection until the next bot restart. **Proper fix** A one-time migration seeder in `internal/database/db.go` (`runSeeders`) that clears `tgBotProxy` and `panelProxy` on the first run after upgrade would prevent this for all existing users. Separately, restoring a `tgBotProxy` input in `frontend/src/pages/settings/TelegramTab.tsx` — even blank on fresh installs — would let users clear or override the proxy from the UI without touching the database directly. *This reply was generated automatically; a maintainer may follow up.*
Author
Owner

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

Fixed in 9a8247fa. Added a one-off migration that clears the legacy panelProxy/tgBotProxy settings on upgrade, so a stale tgBotProxy value no longer masks the panelOutbound egress fallback. The Telegram bot now falls back to the panel outbound when no dedicated bot proxy is set.

<!-- gh-comment-id:4698057588 --> @MHSanaei commented on GitHub (Jun 13, 2026): Fixed in 9a8247fa. Added a one-off migration that clears the legacy `panelProxy`/`tgBotProxy` settings on upgrade, so a stale `tgBotProxy` value no longer masks the `panelOutbound` egress fallback. The Telegram bot now falls back to the panel outbound when no dedicated bot proxy is set.
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#3688
No description provided.