[GH-ISSUE #7045] [Bug]: Telegram bot loses client configuration after initial success in native multi-node setup #5658

Open
opened 2026-11-02 04:02:20 +07:00 by bsakaguchi · 1 comment
Owner

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

Describe the bug

I'm using the built-in multi-node system with several connected nodes and multiple inbounds.

After linking a Telegram account to an existing client, the bot confirms that the account was successfully linked. However, shortly afterward, it starts reporting that the client's configuration cannot be found.

The strange part is that the client still exists, the Telegram ID is correctly displayed in the admin panel, and the bot can sometimes show the client's traffic statistics, connection status, and assigned inbounds.

I noticed that fully restarting the 3x-ui container temporarily fixes the issue. The bot works for one /start, but then the problem returns. Restarting through the panel's built-in restart button does not help.

I suspect that synchronization with the connected sub-nodes may be overwriting or resetting some client information, but I haven't confirmed this.

How to reproduce the problem

  1. Set up 3x-ui with the native multi-node system and several connected nodes.
  2. Create or use an existing client assigned to multiple inbounds.
  3. Link a Telegram account to that client.
  4. Open the Telegram bot and send /start.
  5. Initially, the client information may be displayed correctly.
  6. After some time or subsequent interactions, try /start again or press the "Links" button.
  7. The bot reports that the configuration cannot be found, even though the client still exists in the panel.
  8. Fully restart the 3x-ui container. The bot temporarily works again, but the issue returns.

Expected behavior

Once a Telegram account is linked to a client, the bot should consistently recognize that client and provide access to their configurations, regardless of background node synchronization.

A container restart should not be necessary to restore the Telegram bot's functionality.

Actual behavior

The Telegram account is linked successfully, but the bot intermittently loses access to the client's configuration and displays:

"Your configuration is not found! Please ask your admin to use your Telegram ChatID in your configuration(s)."

The client remains active, and its traffic statistics are still available.

A complete container restart temporarily resolves the issue, while restarting through the panel does not.

Relevant logs

Not collected yet.

Screenshots

Image Image

3x-ui version

3.11.0

Xray-core version

26.10.21

How did you install 3x-ui?

Docker / Docker Compose

Operating system

Debian 13

Which parts of the panel are affected?

Multi-node (sub-nodes), Telegram bot, Subscription (share links / Clash / JSON)

Browser (only if it is a UI bug)

Not applicable.

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 @ergolyam on GitHub (Nov 1, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/7045 ### Describe the bug I'm using the built-in multi-node system with several connected nodes and multiple inbounds. After linking a Telegram account to an existing client, the bot confirms that the account was successfully linked. However, shortly afterward, it starts reporting that the client's configuration cannot be found. The strange part is that the client still exists, the Telegram ID is correctly displayed in the admin panel, and the bot can sometimes show the client's traffic statistics, connection status, and assigned inbounds. I noticed that fully restarting the 3x-ui container temporarily fixes the issue. The bot works for one `/start`, but then the problem returns. Restarting through the panel's built-in restart button does not help. I suspect that synchronization with the connected sub-nodes may be overwriting or resetting some client information, but I haven't confirmed this. ### How to reproduce the problem 1. Set up 3x-ui with the native multi-node system and several connected nodes. 2. Create or use an existing client assigned to multiple inbounds. 3. Link a Telegram account to that client. 4. Open the Telegram bot and send `/start`. 5. Initially, the client information may be displayed correctly. 6. After some time or subsequent interactions, try `/start` again or press the "Links" button. 7. The bot reports that the configuration cannot be found, even though the client still exists in the panel. 8. Fully restart the 3x-ui container. The bot temporarily works again, but the issue returns. ### Expected behavior Once a Telegram account is linked to a client, the bot should consistently recognize that client and provide access to their configurations, regardless of background node synchronization. A container restart should not be necessary to restore the Telegram bot's functionality. ### Actual behavior The Telegram account is linked successfully, but the bot intermittently loses access to the client's configuration and displays: "Your configuration is not found! Please ask your admin to use your Telegram ChatID in your configuration(s)." The client remains active, and its traffic statistics are still available. A complete container restart temporarily resolves the issue, while restarting through the panel does not. ### Relevant logs ```shell Not collected yet. ``` ### Screenshots <img width="565" height="336" alt="Image" src="https://github.com/user-attachments/assets/4c3e0b3b-f42f-41f9-a4b1-59289a7fd21b" /> <img width="627" height="577" alt="Image" src="https://github.com/user-attachments/assets/1ac5088f-4b93-40a3-acde-c1be52cf4c43" /> ### 3x-ui version 3.11.0 ### Xray-core version 26.10.21 ### How did you install 3x-ui? Docker / Docker Compose ### Operating system Debian 13 ### Which parts of the panel are affected? Multi-node (sub-nodes), Telegram bot, Subscription (share links / Clash / JSON) ### Browser (only if it is a UI bug) Not applicable. ### 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).
Author
Owner

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

I can't confirm or rule out a bug yet. The code points to two possible causes, and the facts below would tell me which one you are hitting. I've added the clarification needed label. I couldn't open your screenshots, so please send the details below as text.

Where the message comes from. "Your configuration is not found!" (tgbot.answers.askToAddUserId) is shown in two cases on /start, and also from the Links/QR buttons:

  1. levelOf (internal/web/service/tgbot/tgbot_level.go:20) finds no row in the clients table with your tg_id. You are then treated as a stranger (tgbot_router.go:274-276).
  2. You are recognised, but GetClientTrafficTgBot (internal/web/service/inbound_traffic.go:1073) returns nothing. That query only finds a client when all three of these hold:
    clients.tg_id = ?
    JOIN client_traffics ON client_traffics.email = clients.email
    EXISTS (client_inbounds JOIN inbounds ... WHERE client_inbounds.client_id = clients.id)
    
    This is the case in screenClientHome (screen_views.go:37-39) and openOwnClientScreen (screen_client_views.go:345-352).

How node sync could cause case 1. On every node traffic sync, setRemoteTraffic reads each node's inbound clients and calls SyncInbound (internal/web/service/inbound_node.go:1377). That runs applyClientRecordMerge, which copies the node's value over the panel's value without any check (internal/web/service/client_link.go:76):

row.TgID = incoming.TgID

The startup merge only takes a non-zero value (internal/database/model/model.go:1612):

if existing.TgID != incoming.TgID && incoming.TgID != 0 {

So if any node's copy of the client has tgId: 0, each sync would reset clients.tg_id to 0. A full container restart rebuilds the records from the panel's own JSON, which would explain why the bot works once and then breaks again. This is a guess about your setup: I can't see what your nodes report.

There's one problem with that theory. You say the panel still shows the Telegram ID, and the Clients list reads that column directly (ClientService.List, client_lookup.go:183). If the ID really is visible at the moment the bot fails, you are in case 2 instead: a missing client_traffics row or a missing client_inbounds link.

Please reply with:

  1. Right after the bot shows the error, open the client in the panel's Clients page (not the inbound's JSON). Is the Telegram ID still filled in, or does it show 0?
  2. At that same moment, the output of these queries (SQLite: sqlite3 /etc/x-ui/x-ui.db inside the container), with the client's email substituted:
    SELECT id, email, tg_id, enable FROM clients WHERE email = 'EMAIL';
    SELECT * FROM client_inbounds WHERE client_id = (SELECT id FROM clients WHERE email = 'EMAIL');
    SELECT id, inbound_id, email FROM client_traffics WHERE email = 'EMAIL';
    
  3. How you linked the account: the bot invite link (/start <code>), or by typing the ChatID into the client form.
  4. The 3x-ui version running on each node (Nodes page). Is it 3.11.0 on all of them?
  5. Any panel log lines that mention setRemoteTraffic or tgbot from around the time it breaks.
Verdict:        Insufficient information
Severity:       N/A
Confidence:     Low
Root cause:     Not settled. Candidate: client_link.go:76 `row.TgID = incoming.TgID` in applyClientRecordMerge lets a node snapshot carrying tgId 0 clear clients.tg_id on every setRemoteTraffic -> SyncInbound (inbound_node.go:1377). Alternative: the client_traffics JOIN or client_inbounds EXISTS in GetClientTrafficTgBot (inbound_traffic.go:1083-1087) fails while tg_id is intact.
Same class:     Not mapped until the cause is known. levelOf, screenClientHome, openOwnClientScreen and getClientUsage (tgbot_client.go:369) all read the same rows.
Already fixed:  No related fix in v3.11.0..1bdb517b; still present on the default branch if the candidate is right
Duplicate of:   Related: #5805 (tgId lookup failure, different cause: compacted JSON)
Evidence:       tgbot_level.go:20-31; tgbot_router.go:274-276; screen_views.go:37-39; inbound_traffic.go:1073-1102; client_link.go:76 vs model.go:1612; client_lookup.go:183-186
Not determined: Whether clients.tg_id is 0, or the client_traffics / client_inbounds rows are missing, at the moment the bot fails. Query 2 above settles it.

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

<!-- gh-comment-id:6561618260 --> @github-actions[bot] commented on GitHub (Nov 1, 2026): I can't confirm or rule out a bug yet. The code points to two possible causes, and the facts below would tell me which one you are hitting. I've added the `clarification needed` label. I couldn't open your screenshots, so please send the details below as text. **Where the message comes from.** "Your configuration is not found!" (`tgbot.answers.askToAddUserId`) is shown in two cases on `/start`, and also from the Links/QR buttons: 1. `levelOf` (`internal/web/service/tgbot/tgbot_level.go:20`) finds no row in the `clients` table with your `tg_id`. You are then treated as a stranger (`tgbot_router.go:274-276`). 2. You are recognised, but `GetClientTrafficTgBot` (`internal/web/service/inbound_traffic.go:1073`) returns nothing. That query only finds a client when all three of these hold: ```sql clients.tg_id = ? JOIN client_traffics ON client_traffics.email = clients.email EXISTS (client_inbounds JOIN inbounds ... WHERE client_inbounds.client_id = clients.id) ``` This is the case in `screenClientHome` (`screen_views.go:37-39`) and `openOwnClientScreen` (`screen_client_views.go:345-352`). **How node sync could cause case 1.** On every node traffic sync, `setRemoteTraffic` reads each node's inbound clients and calls `SyncInbound` (`internal/web/service/inbound_node.go:1377`). That runs `applyClientRecordMerge`, which copies the node's value over the panel's value without any check (`internal/web/service/client_link.go:76`): ```go row.TgID = incoming.TgID ``` The startup merge only takes a non-zero value (`internal/database/model/model.go:1612`): ```go if existing.TgID != incoming.TgID && incoming.TgID != 0 { ``` So if any node's copy of the client has `tgId: 0`, each sync would reset `clients.tg_id` to 0. A full container restart rebuilds the records from the panel's own JSON, which would explain why the bot works once and then breaks again. This is a guess about your setup: I can't see what your nodes report. There's one problem with that theory. You say the panel still shows the Telegram ID, and the Clients list reads that column directly (`ClientService.List`, `client_lookup.go:183`). If the ID really is visible at the moment the bot fails, you are in case 2 instead: a missing `client_traffics` row or a missing `client_inbounds` link. **Please reply with:** 1. Right after the bot shows the error, open the client in the panel's **Clients** page (not the inbound's JSON). Is the Telegram ID still filled in, or does it show 0? 2. At that same moment, the output of these queries (SQLite: `sqlite3 /etc/x-ui/x-ui.db` inside the container), with the client's email substituted: ```sql SELECT id, email, tg_id, enable FROM clients WHERE email = 'EMAIL'; SELECT * FROM client_inbounds WHERE client_id = (SELECT id FROM clients WHERE email = 'EMAIL'); SELECT id, inbound_id, email FROM client_traffics WHERE email = 'EMAIL'; ``` 3. How you linked the account: the bot invite link (`/start <code>`), or by typing the ChatID into the client form. 4. The 3x-ui version running on each node (Nodes page). Is it 3.11.0 on all of them? 5. Any panel log lines that mention `setRemoteTraffic` or `tgbot` from around the time it breaks. ``` Verdict: Insufficient information Severity: N/A Confidence: Low Root cause: Not settled. Candidate: client_link.go:76 `row.TgID = incoming.TgID` in applyClientRecordMerge lets a node snapshot carrying tgId 0 clear clients.tg_id on every setRemoteTraffic -> SyncInbound (inbound_node.go:1377). Alternative: the client_traffics JOIN or client_inbounds EXISTS in GetClientTrafficTgBot (inbound_traffic.go:1083-1087) fails while tg_id is intact. Same class: Not mapped until the cause is known. levelOf, screenClientHome, openOwnClientScreen and getClientUsage (tgbot_client.go:369) all read the same rows. Already fixed: No related fix in v3.11.0..1bdb517b; still present on the default branch if the candidate is right Duplicate of: Related: #5805 (tgId lookup failure, different cause: compacted JSON) Evidence: tgbot_level.go:20-31; tgbot_router.go:274-276; screen_views.go:37-39; inbound_traffic.go:1073-1102; client_link.go:76 vs model.go:1612; client_lookup.go:183-186 Not determined: Whether clients.tg_id is 0, or the client_traffics / client_inbounds rows are missing, at the moment the bot fails. Query 2 above settles it. ``` *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
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#5658
No description provided.