mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5726] [Bug]: subJsonPath is generated without leading slash causing Zod validation failure #3985
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#3985
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 @OlMat77 on GitHub (Jul 2, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5726
Describe the bug
Version
3X-UI v3.4.2
Xray 26.6.27
Describe the bug
When editing HApp routing rules and clicking Save, the panel shows:
[zod] setting/all response failed validation
Expected value
Root cause
The frontend validates
subJsonPathand requires it to start with/.The backend stores it without the leading slash.
Workaround
Restart x-ui:
After that:
Browser console
How to reproduce the problem
Workaround
Restart x-ui:
After that:
Expected behavior
No response
Actual behavior
No response
Relevant logs
Screenshots
3x-ui version
3.4.2
Xray-core version
No response
How did you install 3x-ui?
Manual build from source
Operating system
Ubuntu 24.04
Which parts of the panel are affected?
Subscription (share links / Clash / JSON)
Browser (only if it is a UI bug)
No response
Is the panel behind a reverse proxy or CDN?
No response
Before submitting
@github-actions[bot] commented on GitHub (Jul 2, 2026):
Confirmed the root cause in source. This is the same underlying defect as #4946 and #5302, triggered by a different starting value (a legacy path without slashes instead of an empty string) — and it is still present in the current code, so it is worth tracking separately.
What is happening
onSave()infrontend/src/pages/settings/SettingsPage.tsx:126runsAllSettingSchema.safeParse(allSetting)against the entire settings draft before allowing any save.subJsonPath(likesubPath,subClashPath,webBasePath) must match^\/(frontend/src/schemas/setting.ts:5, used at line 47). Since your storedsubJsonPath(YIrCXJOOOL) already lacked the leading slash, any edit anywhere on the Settings page — including unrelated routing rules — gets blocked by this pre-existing bad value.internal/web/service/setting.go,GetAllSetting()copies string settings verbatim (fieldV.SetString(value)around line 212), unlikeint/boolfields which fall back to defaults viaeffectiveSettingValue(). So whatever is in thesettingstable forsubJsonPathis sent to the frontend unchanged.AllSetting.CheckValid()(internal/web/entity/entity.go:229-234) auto-adds the missing leading/trailing slash tosubJsonPathbefore persisting — but only when a save request actually reaches the server. Because step 1 blocks the request client-side, this normalization never gets a chance to run.pages.settings.validation.pathLeadingSlashis not defined in any file underinternal/web/translation/(checked all 13 locales), so i18next falls back to printing the raw key instead of a readable message.[zod] setting/all response failed validationconsole line is a separate, non-blocking warning fromfrontend/src/utils/zodValidate.tson the initial GET — it does not by itself prevent saving; the actual block is the save-time check described above.As for how
subJsonPathended up without slashes in your database:GetAllSetting/CheckValiddon't retroactively fix values that were already stored before this validation rule existed (or set by any means other than the current Settings-page save path), so a legacy value like this persists indefinitely and only surfaces once the frontend starts enforcing the leading-slash rule.Workarounds
No SSH needed: on the Settings page, go to Subscription Settings → Subscription Formats → JSON Path field, click into it and then click/tab out (this fires the
onBlurhandler infrontend/src/pages/settings/SubscriptionFormatsTab.tsx:159, which callsnormalizePath()and rewrites the value to something like/YIrCXJOOOL/), then Save.Direct DB fix (what you already did):
It's also worth checking
subPathandsubClashPathfor the same issue, since they use identical validation:This reply was generated automatically; a maintainer may follow up.
@MHSanaei commented on GitHub (Jul 2, 2026):
Fixed in
a335456c. Confirmed root cause: your storedsubJsonPathpredates the leading/trailing-slash rule, and the Settings page validates the whole form before any save — so the pre-existing bad value blocked every save (including unrelated HApp routing edits), while the backend's self-heal only runs on a save that never got sent. The panel now normalizes storedwebBasePath/subPath/subJsonPath/subClashPathvalues at startup (idempotent, also covers restored backups), and the previously-missingpages.settings.validation.pathLeadingSlashtranslation was added to all 13 locales so the error reads properly if it ever appears again. Your SQL workaround is exactly what the startup fix now does automatically. Ships in the next release.@OlMat77 commented on GitHub (Jul 2, 2026):
Thank you for the quick investigation and fix.
I can confirm that updating subJsonPath to include the leading slash immediately resolved the issue on my installation.
I appreciate both the startup normalization and the improved validation message. Great work!