mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[GH-ISSUE #6009] [Bug]: Shadowsocks client renewal fails with Client.tgId JSON error #4160
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#4160
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mori-1997-mori2276-cmd on GitHub (Jul 17, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6009
Describe the bug
Hello. I found a bug in the latest x-ui version. When editing or renewing a Shadowsocks client, the panel returns this error:
json: cannot unmarshal string into Go struct field Client.tgId of type int64
This issue only happens with Shadowsocks clients. VLESS works normally. If I downgrade to x-ui v3.4.2, the problem disappears. Could you please check if this is a regression in the latest release? Thank you.
How to reproduce the problem
Install the latest x-ui version.
Create a Shadowsocks client (or use an existing one).
Open the client and change any value (or renew/extend the expiry time).
Click Save.
The panel returns the following error:
Expected behavior
No response
Actual behavior
No response
Relevant logs
Screenshots
3x-ui version
3.5.0
Xray-core version
26.7.11
How did you install 3x-ui?
install.sh script
Operating system
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
@github-actions[bot] commented on GitHub (Jul 17, 2026):
This is the same underlying bug as #5934: identical error (
json: cannot unmarshal string into Go struct field Client.tgId of type int64) on the same version (3.5.0). Closing as a duplicate to keep the discussion in one place — please follow #5934 for the full root-cause write-up and an unblocking workaround.Root cause:
model.Client.TgID(internal/database/model/model.go:817) is a strictint64. If the affected inbound's storedsettings.clients[]contains a client with a non-numeric legacytgId(e.g. an old""value),ParseInboundSettingsClients(internal/web/service/inbound_settings_clients.go:28) fails to unmarshal the whole array.UpdateInboundClientreloads the target inbound's existing clients first (internal/web/service/client_inbound_apply.go:546), so this fails before your submitted changes are even applied — independent of what you actually changed.On your two specific questions:
TgIDand the parser above are shared by every protocol, so this is per-inbound, not per-protocol. It means your Shadowsocks inbound has at least one client with a stale non-numerictgIdin its stored settings, while your VLESS inbound(s) don't — it isn't Shadowsocks-specific.GetClientsbetween thev3.4.2tag and current source: inv3.4.2,GetClients(then ininternal/web/service/inbound.go) discarded the unmarshal error (_ = json.Unmarshal([]byte(inbound.Settings), &settings)) and silently returned whatever partial data resulted, so a staletgIdwas tolerated silently. In the current source,GetClients(internal/web/service/inbound.go:442) instead callsParseInboundSettingsClients, which correctly propagates that same error rather than swallowing it. So the pre-existing bad data only starts blocking edits after upgrading past that refactor — downgrading doesn't remove the bad data, it just goes back to silently ignoring it.3x-ui ships a one-shot migration meant to heal this (
normalizeInboundClientTgId,internal/database/db.go:1352, theInboundClientTgIdFixseeder) that should rewrite any non-numerictgIdto0on first startup after upgrade. #5934 lists the diagnostics to check whether that migration ran/completed for your database, plus a SQL workaround to unblock the affected inbound directly.@MHSanaei for awareness — flagging the regression angle confirmed above (parser went from error-swallowing to error-propagating) as additional context on top of what's already tracked in #5934.
This reply was generated automatically. A maintainer may follow up.