[GH-ISSUE #5406] [BUG]: Copy your embed code: (Cannot read properties of undefined (reading 'writeText') #5073

Closed
opened 2026-06-05 14:51:51 -04:00 by yindo · 1 comment
Owner

Originally created by @ohromeo on GitHub (Apr 10, 2026).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/5406

How are you running AnythingLLM?

Docker (local)

What happened?

created a test "chat" embed code, trying to click copy code button does nothing and throws an error:
index.js:37 Uncaught TypeError: Cannot read properties of undefined (reading 'writeText')
at m (index-99f83b2c.js:12:220)
at Object.z_ (index.js:37:9855)
at M_ (index.js:37:10009)
at P_ (index.js:37:10066)
at Nh (index.js:37:31466)
at iv (index.js:37:31883)

Image

Are there known steps to reproduce?

No response

LLM Provider & Model (if applicable)

No response

Embedder Provider & Model (if applicable)

No response

Originally created by @ohromeo on GitHub (Apr 10, 2026). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/5406 ### How are you running AnythingLLM? Docker (local) ### What happened? created a test "chat" embed code, trying to click copy code button does nothing and throws an error: index.js:37 Uncaught TypeError: Cannot read properties of undefined (reading 'writeText') at m (index-99f83b2c.js:12:220) at Object.z_ (index.js:37:9855) at M_ (index.js:37:10009) at P_ (index.js:37:10066) at Nh (index.js:37:31466) at iv (index.js:37:31883) <img width="1379" height="963" alt="Image" src="https://github.com/user-attachments/assets/3a1d1992-4756-4ed3-989f-26a21a0d1cbd" /> ### Are there known steps to reproduce? _No response_ ### LLM Provider & Model (if applicable) _No response_ ### Embedder Provider & Model (if applicable) _No response_
yindo added the possible bug label 2026-06-05 14:51:51 -04:00
yindo closed this issue 2026-06-05 14:51:51 -04:00
Author
Owner

@timothycarambat commented on GitHub (Apr 10, 2026):

This is expected behavior, not a bug. The navigator.clipboard API is only available in secure contexts, which means:

  • HTTPS connections
  • localhost / 127.0.0.1

If you're hosting AnythingLLM on a remote server over plain HTTP, the browser will not expose the Clipboard API at all (navigator.clipboard is undefined), which causes this error.

Solutions:

  • Use HTTPS - Set up a reverse proxy (nginx, Caddy, Traefik) with SSL/TLS in front of your AnythingLLM instance
  • Use localhost - If accessing from the same machine, use localhost instead of the IP/hostname
  • Manual copy - Select the code snippet text and copy it manually (Ctrl+C / Cmd+C)

This is a browser security restriction, not something AnythingLLM can work around. Modern browsers intentionally block clipboard access on insecure origins to prevent malicious sites from reading or writing clipboard data without user knowledge.

<!-- gh-comment-id:4228079165 --> @timothycarambat commented on GitHub (Apr 10, 2026): This is expected behavior, not a bug. The navigator.clipboard API is only available in [secure contexts](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard), which means: - HTTPS connections - localhost / 127.0.0.1 If you're hosting AnythingLLM on a remote server over plain HTTP, the browser will not expose the Clipboard API at all (navigator.clipboard is undefined), which causes this error. Solutions: - Use HTTPS - Set up a reverse proxy (nginx, Caddy, Traefik) with SSL/TLS in front of your AnythingLLM instance - Use localhost - If accessing from the same machine, use localhost instead of the IP/hostname - Manual copy - Select the code snippet text and copy it manually (Ctrl+C / Cmd+C) This is a browser security restriction, not something AnythingLLM can work around. Modern browsers intentionally block clipboard access on insecure origins to prevent malicious sites from reading or writing clipboard data without user knowledge.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#5073