dify icon indicating copy to clipboard operation
dify copied to clipboard

Version 1.19.0, the problem classifier cannot add a category by clicking

Open dengyazhou opened this issue 2 weeks ago • 11 comments

Self Checks

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

Dify version

1.19.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

image

✔️ Expected Behavior

Hope to click "Add"

❌ Actual Behavior

No response

dengyazhou avatar Nov 19 '26 06:11 dengyazhou

Hi @dengyazhou! I'm Dosu and I'm helping the Dify team.

This may match #45643, which reports the same Add Category failure on 1.19.0 with TypeError: crypto.randomUUID is not a function. It occurs when the category handler uses a browser API unavailable on a non-secure LAN HTTP address. [1]

On the affected page, open DevTools → Console and run these read-only checks:

window.isSecureContext
typeof globalThis.crypto?.randomUUID

If they return false and "undefined", and clicking Add logs that error, the workaround is to access Dify through HTTPS with a browser-trusted certificate, rather than http://<server-IP>. Maintainers have consolidated this classifier failure in #45147. [2]

If you're already using trusted HTTPS, please share your browser/version and the Console error produced when clicking Add, so we can distinguish your case from that failure.

To reply, just mention @dosu.


Docs are dead. Just use Dosu.

Leave Feedback Ask Dosu about dify

dosubot[bot] avatar Nov 19 '26 06:11 dosubot[bot]

Can you open your browser console (F12) when clicking "Add" and share the error log here?

grinem avatar Nov 19 '26 06:11 grinem

Diagnosis: the Add button in the question classifier's class list calls crypto.randomUUID() to build the new class ID. That API exists only in secure contexts (HTTPS or localhost); a self-hosted 1.19.0 deployment served over plain HTTP has no crypto.randomUUID, so clicking Add throws TypeError: crypto.randomUUID is not a function and no category can be added - matching your screenshot.

Good news: this was fixed on main today by #46720 (the class list now uses the uuid package's v4, which works in every context). The fix is scheduled for the 1.20.0 release; 1.19.0 shipped before it landed. Nothing further to fix here, so I'll leave it - closing as already addressed on main (the maintainers can confirm).

Luckyou-d avatar Nov 19 '26 07:11 Luckyou-d

image. It has been temporarily resolved.Access with localhost.ssh -N -L 8000:127.0.0.1:80 [email protected]

dengyazhou avatar Nov 19 '26 07:11 dengyazhou

image @dosu

dengyazhou avatar Nov 19 '26 07:11 dengyazhou

That console error confirms the crypto.randomUUID() failure discussed above. Your SSH tunnel works because opening Dify at http://localhost:8000 gives the browser a trustworthy local context, unlike a plain HTTP LAN-IP address. This matches the cause documented in #46720.

As of November 19, the fix has merged into main: Question Classifier category IDs now use the uuid package instead of calling crypto.randomUUID() directly. The PR does not confirm a release version, so I would not promise 1.20.0 yet. You can keep using your localhost tunnel, or browser-trusted HTTPS, as the workaround. Fix details

To reply, just mention @dosu.


Share context across your team and agents. Try Dosu.

Leave Feedback Learn about dify with Dosu

dosubot[bot] avatar Nov 19 '26 07:11 dosubot[bot]

I see.

dengyazhou avatar Nov 19 '26 07:11 dengyazhou

Thanks for the report! Confirmed the root cause: the "Add" button in the question classifier calls crypto.randomUUID(), which only exists in secure contexts (HTTPS or localhost). On a self-hosted deployment served over plain HTTP it is undefined, so clicking Add throws and no class can be created.

I've opened #46815 to guard the call and fall back to a timestamp-based id, matching the pattern already used in use-document-actions.ts. The same unguarded call in the agent output-routes toggle is fixed too.

fxia0018 avatar Nov 20 '26 03:11 fxia0018

Spot on. crypto.randomUUID() will throw on plain HTTP / raw IP since the browser won't treat it as a secure context.

Just heads up on PR #46815: sticking strictly to a timestamp fallback can lead to duplicate keys if someone double-clicks fast or loops through a batch add. Something like Date.now() + '-' + Math.random().toString(36).substring(2, 9) or a quick uuid polyfill avoids those collision issues completely.

Also worth checking the agent output-routes toggle while you're in there, it runs into the exact same problem.

grinem avatar Nov 20 '26 10:11 grinem

I encountered the same problem in the latest version v1.20.0, but it seems that it hasn't been fixed.

image

E218PQ avatar Nov 21 '26 08:11 E218PQ

Looks like the add button handler is failing to update the node's local state properly or hitting an unhandled React exception on click. If you check your browser console (F12) while clicking it, you'll probably see a silent TypeError related to array manipulation or state dispatch.

Quick workaround while waiting for a patch: export the workflow DSL as YAML, find the question-classifier node, manually append your new categories into its classes array, and re-import it. That bypasses the broken UI button entirely and keeps your graph intact. Let me know if it work's for you

grinem avatar Nov 21 '26 09:11 grinem