dify - ✅(Solved) Fix Can't change Visual Editor to JSON Schema [1 pull requests, 1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
langgenius/dify#34841Fetched 2026-04-10 03:45:45
View on GitHub
Comments
1
Participants
1
Timeline
2
Reactions
1
Participants
Timeline (top)
commented ×1labeled ×1

Error Message

When i wanna jump from JSON Schema to Visual Editor, there is a error msg Error: Failed to construct 'URL': Invalid URL

PR fix notes

PR #35004: fix: handle URL construction error when switching to Visual Editor

Description (problem / solution / changelog)

Summary

The jsonschema library's Validator.validate() internally calls new URL() for URI resolution of schema $id references, which can throw "Failed to construct 'URL': Invalid URL" in browser environments. This uncaught error propagated up to handleTabChange, where it was caught as a parse error — blocking the switch from JSON Schema to Visual Editor.

Added a try-catch in draft07Validator (web/utils/validators.ts) to handle this gracefully, returning empty validation errors on failure since structural schema validation is already covered by preValidateSchema.

Fixes #34841

Screenshots

N/A — the fix restores expected behavior (tab switching works without errors).

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran make lint and make type-check (backend) and cd web && pnpm exec vp staged (frontend) to appease the lint gods

From Claude Code

Changed files

  • web/utils/validators.ts (modified, +13/-3)
RAW_BUFFERClick to expand / collapse

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.11.2 && cloud

Cloud or Self Hosted

Self Hosted (Source), Cloud

Steps to reproduce

<img width="870" height="203" alt="Image" src="https://github.com/user-attachments/assets/08440e93-6106-4b23-8266-d0c281347e00" /> <img width="958" height="790" alt="Image" src="https://github.com/user-attachments/assets/37d6b78b-579c-42d3-b305-747bbd042ce5" />

{ "type": "object", "properties": { "name": { "type": "string", "description": "动物名称" }, "category": { "type": "string", "enum": [ "哺乳动物", "鸟类", "鱼类" ] }, "habitat": { "type": "string", "description": "栖息地" }, "lifeSpan": { "type": "number", "description": "平均寿命(年)" } }, "required": [ "name", "category", "habitat" ], "additionalProperties": false }

i can run the workflow correctly.

✔️ Expected Behavior

I can jump to Visual Editor panel correctly.

❌ Actual Behavior

When i wanna jump from JSON Schema to Visual Editor, there is a error msg Error: Failed to construct 'URL': Invalid URL

extent analysis

TL;DR

The most likely fix is to validate and correct the URL construction in the code that handles the jump from JSON Schema to Visual Editor.

Guidance

  • Verify that the URL being constructed is valid and properly formatted, checking for any special characters or encoding issues.
  • Check the code that handles the jump from JSON Schema to Visual Editor for any potential errors in URL construction, such as missing or incorrect protocol, hostname, or path.
  • Ensure that the href attribute or any other URL-related properties are correctly set and escaped in the HTML or template code.
  • Review the browser's console logs for any additional error messages that may provide more insight into the issue.

Notes

The provided information does not include the specific code that handles the URL construction, so it's difficult to provide a more detailed solution. However, the error message "Invalid URL" suggests that the issue is related to the URL construction.

Recommendation

Apply workaround: Validate and correct the URL construction in the code to ensure that it produces a valid and properly formatted URL. This may involve adding input validation, encoding special characters, or modifying the URL construction logic.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING