[GH-ISSUE #19717] issue: "Save" button for code blocks does nothing, while "Copy" and "Run" work fine #18965

Closed
opened 2026-04-20 01:15:06 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @Prostagma1 on GitHub (Dec 3, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/19717

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!).
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

v0.6.41

Ollama Version (if applicable)

No response

Operating System

Windows 11

Browser (if applicable)

Chrome 142.0

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

Expected Behavior

When clicking the "Save" button next to a code block (e.g., python ...), the browser should download a file with the appropriate name and extension (e.g., code.py). This is the standard behavior for code export in chat interfaces.

Actual Behavior

Clicking the "Save" button results in no action:

  • No file is downloaded.
  • No request appears in the Network tab.
  • No error is shown in the browser console.
  • Other buttons ("Copy", "Run", "Collapse") work correctly on the same code block.

However, manually executing a Blob-based download script in the browser console successfully downloads the file, proving the content and permissions are valid.

Steps to Reproduce

  1. Start with a clean system (e.g., Ubuntu 22.04 or Windows 11).
  2. Install Docker Engine (version ≥24.0).
  3. Pull and run the official Open WebUI image
docker run -d -p 3000:8080 \
  --add-host=host.docker.internal:host-gateway \
  -v open-webui-data:/app/backend/data \
  --name open-webui \
  ghcr.io/open-webui/open-webui:main
  1. Wait for the container to start (docker logs -f open-webui shows "Application startup complete").
  2. Open Google Chrome 125 (or Firefox 126) in incognito mode.
  3. Navigate to http://localhost:3000.
  4. Complete onboarding (create user, connect to Ollama or any backend).
  5. In the chat, send the prompt:
    Write a simple "Hello, World!" program in Python
  6. Wait for the response containing:
    print("Hello, World!")
  7. Hover over the code block to reveal action buttons.
  8. Click the "Save" button (not "Copy" or "Run").
  9. Observe: nothing happens — no file is saved, no visual feedback, no console error.
  10. Verification step: Open DevTools (F12), go to Console, and run
const lang = document.querySelector('.code-block')?.getAttribute('data-language') || 'txt';
const ext = ({python:'py', javascript:'js', typescript:'ts', html:'html', css:'css', json:'json', markdown:'md', bash:'sh'})[lang] || 'txt';
const blob = new Blob([code], {type: 'text/plain'});
const a = document.createElement('a');
a.href = URL.createObjectURL(blob);
a.download = `code.${ext}`;
a.click();
URL.revokeObjectURL(a.href);

→ Result: file downloads successfully.

Logs & Screenshots

Browser console output (no errors, only warning):

[tiptap warn]: Duplicate extension names found: ['codeBlock', 'bulletList', 'listItem', 'listKeymap', 'orderedList']. This can lead to issues.

Docker logs (relevant part):

2025-12-03 12:16:52.897 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - ...:48350 - "POST /api/v1/chats/... HTTP/1.1" 200

→ No errors related to file download (as expected — it’s client-side).

Additional Information

  • The issue is client-side only — no server interaction is involved in the "Save" action.
  • The fact that manual Blob download works confirms:
  • The code content is accessible.
  • Browser permissions are not blocking downloads.
  • This strongly suggests a bug in the click handler for .save-code-button, likely due to:
  • Incorrect DOM traversal (e.g., after Tiptap/Svelte update),
  • Silent failure when generating filename (e.g., code.undefined),
  • Or event handler not being properly bound due to duplicate Tiptap extensions (as per console warning).
Originally created by @Prostagma1 on GitHub (Dec 3, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/19717 ### Check Existing Issues - [x] I have searched for any existing and/or related issues. - [x] I have searched for any existing and/or related discussions. - [x] I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!). - [x] I am using the latest version of Open WebUI. ### Installation Method Docker ### Open WebUI Version v0.6.41 ### Ollama Version (if applicable) _No response_ ### Operating System Windows 11 ### Browser (if applicable) Chrome 142.0 ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have **provided every relevant configuration, setting, and environment variable used in my setup.** - [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc). - [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps: - Start with the initial platform/version/OS and dependencies used, - Specify exact install/launch/configure commands, - List URLs visited, user input (incl. example values/emails/passwords if needed), - Describe all options and toggles enabled or changed, - Include any files or environmental changes, - Identify the expected and actual result at each stage, - Ensure any reasonably skilled user can follow and hit the same issue. ### Expected Behavior When clicking the "Save" button next to a code block (e.g., python ...), the browser should download a file with the appropriate name and extension (e.g., code.py). This is the standard behavior for code export in chat interfaces. ### Actual Behavior Clicking the "Save" button results in no action: - No file is downloaded. - No request appears in the Network tab. - No error is shown in the browser console. - Other buttons ("Copy", "Run", "Collapse") work correctly on the same code block. However, manually executing a Blob-based download script in the browser console successfully downloads the file, proving the content and permissions are valid. ### Steps to Reproduce 1. Start with a clean system (e.g., Ubuntu 22.04 or Windows 11). 2. Install Docker Engine (version ≥24.0). 3. Pull and run the official Open WebUI image ``` docker run -d -p 3000:8080 \ --add-host=host.docker.internal:host-gateway \ -v open-webui-data:/app/backend/data \ --name open-webui \ ghcr.io/open-webui/open-webui:main ``` 4. Wait for the container to start (docker logs -f open-webui shows "Application startup complete"). 5. Open Google Chrome 125 (or Firefox 126) in incognito mode. 6. Navigate to http://localhost:3000. 7. Complete onboarding (create user, connect to Ollama or any backend). 8. In the chat, send the prompt: ```Write a simple "Hello, World!" program in Python``` 9. Wait for the response containing: ```print("Hello, World!")``` 10. Hover over the code block to reveal action buttons. 11. Click the "Save" button (not "Copy" or "Run"). 12. Observe: nothing happens — no file is saved, no visual feedback, no console error. 13. Verification step: Open DevTools (F12), go to Console, and run ```const code = document.querySelector('.code-block pre')?.innerText; const lang = document.querySelector('.code-block')?.getAttribute('data-language') || 'txt'; const ext = ({python:'py', javascript:'js', typescript:'ts', html:'html', css:'css', json:'json', markdown:'md', bash:'sh'})[lang] || 'txt'; const blob = new Blob([code], {type: 'text/plain'}); const a = document.createElement('a'); a.href = URL.createObjectURL(blob); a.download = `code.${ext}`; a.click(); URL.revokeObjectURL(a.href); ``` → Result: file downloads successfully. ### Logs & Screenshots Browser console output (no errors, only warning): ``` [tiptap warn]: Duplicate extension names found: ['codeBlock', 'bulletList', 'listItem', 'listKeymap', 'orderedList']. This can lead to issues. ``` Docker logs (relevant part): ``` 2025-12-03 12:16:52.897 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - ...:48350 - "POST /api/v1/chats/... HTTP/1.1" 200 ``` → No errors related to file download (as expected — it’s client-side). ### Additional Information - The issue is client-side only — no server interaction is involved in the "Save" action. - The fact that manual Blob download works confirms: - The code content is accessible. - Browser permissions are not blocking downloads. - This strongly suggests a bug in the click handler for .save-code-button, likely due to: - Incorrect DOM traversal (e.g., after Tiptap/Svelte update), - Silent failure when generating filename (e.g., code.undefined), - Or event handler not being properly bound due to duplicate Tiptap extensions (as per console warning).
GiteaMirror added the bug label 2026-04-20 01:15:06 -05:00
Author
Owner

@owui-terminator[bot] commented on GitHub (Dec 3, 2025):

🔍 Similar Issues Found

I found some existing issues that might be related to this one. Please check if any of these are duplicates or contain helpful solutions:

  1. #19335 issue: model page Save & Update button not working in latest dev version
    by jtabox • Nov 21, 2025 • bug

  2. #19414 issue: Save button becomes unresponsive when adding a JSON-formatted custom header with syntax errors (dev branch only)
    by ctolon • Nov 24, 2025 • bug

  3. #12235 issue: DOC...Collapse Save Copy code view
    by OzSpots-Wireless • Mar 31, 2025 • bug

  4. #15745 issue: code block is not working in user's prompt
    by navilg • Jul 15, 2025 • bug

  5. #18922 issue: When code is present in the return output, the dialog box does not use code blocks.
    by pureGavin • Nov 04, 2025 • bug

Show 5 more related issues
  1. #19563 issue:
    by naruto7g • Nov 28, 2025 • bug

  2. #16745 issue: Copy button in code blocks copies the original AI output instead of the edited content
    by yuliang615 • Aug 20, 2025 • bug

  3. #19211 issue:
    by Byrnes9 • Nov 16, 2025 • bug

  4. #19083 issue: output always copied with formatting (chrome)
    by tomasloksa • Nov 10, 2025 • bug, good first issue

  5. #19047 issue: followup questions sometimes fail to generate
    by avidwriter • Nov 08, 2025 • bug


💡 Tips:

  • If this is a duplicate, please consider closing this issue and adding any additional details to the existing one
  • If you found a solution in any of these issues, please share it here to help others

This comment was generated automatically by a bot. Please react with a 👍 if this comment was helpful, or a 👎 if it was not.

<!-- gh-comment-id:3606730059 --> @owui-terminator[bot] commented on GitHub (Dec 3, 2025): 🔍 **Similar Issues Found** I found some existing issues that might be related to this one. Please check if any of these are duplicates or contain helpful solutions: 1. [#19335](https://github.com/open-webui/open-webui/issues/19335) **issue: model page Save & Update button not working in latest dev version** *by jtabox • Nov 21, 2025 • `bug`* 2. [#19414](https://github.com/open-webui/open-webui/issues/19414) **issue: Save button becomes unresponsive when adding a JSON-formatted custom header with syntax errors (dev branch only)** *by ctolon • Nov 24, 2025 • `bug`* 3. [#12235](https://github.com/open-webui/open-webui/issues/12235) **issue: DOC...Collapse Save Copy code view** *by OzSpots-Wireless • Mar 31, 2025 • `bug`* 4. [#15745](https://github.com/open-webui/open-webui/issues/15745) **issue: code block is not working in user's prompt** *by navilg • Jul 15, 2025 • `bug`* 5. [#18922](https://github.com/open-webui/open-webui/issues/18922) **issue: When code is present in the return output, the dialog box does not use code blocks.** *by pureGavin • Nov 04, 2025 • `bug`* <details> <summary>Show 5 more related issues</summary> 6. [#19563](https://github.com/open-webui/open-webui/issues/19563) **issue:** *by naruto7g • Nov 28, 2025 • `bug`* 7. [#16745](https://github.com/open-webui/open-webui/issues/16745) **issue: Copy button in code blocks copies the original AI output instead of the edited content** *by yuliang615 • Aug 20, 2025 • `bug`* 8. [#19211](https://github.com/open-webui/open-webui/issues/19211) **issue:** *by Byrnes9 • Nov 16, 2025 • `bug`* 9. [#19083](https://github.com/open-webui/open-webui/issues/19083) **issue: output always copied with formatting (chrome)** *by tomasloksa • Nov 10, 2025 • `bug`, `good first issue`* 10. [#19047](https://github.com/open-webui/open-webui/issues/19047) **issue: followup questions sometimes fail to generate** *by avidwriter • Nov 08, 2025 • `bug`* </details> --- 💡 **Tips:** - If this is a duplicate, please consider closing this issue and adding any additional details to the existing one - If you found a solution in any of these issues, please share it here to help others *This comment was generated automatically by a bot.* Please react with a 👍 if this comment was helpful, or a 👎 if it was not.
Author
Owner

@Classic298 commented on GitHub (Dec 3, 2025):

The save button changes your modifications

edit the code
click save
reload page
observe your changes are still there

its not a download button, it is to save the code

<!-- gh-comment-id:3606745973 --> @Classic298 commented on GitHub (Dec 3, 2025): The save button changes your modifications edit the code click save reload page observe your changes are still there its not a download button, it is to save the code
Author
Owner

@Prostagma1 commented on GitHub (Dec 3, 2025):

Ah, got it! Thanks for clarifying.
I misunderstood the purpose of the button - I thought "Save" meant "Download as file", not "Save edits to the message".
Maybe a tooltip or different label (like "Save edits") would help avoid confusion for other users too.
Anyway, thanks for the explanation!

<!-- gh-comment-id:3606829902 --> @Prostagma1 commented on GitHub (Dec 3, 2025): Ah, got it! Thanks for clarifying. I misunderstood the purpose of the button - I thought "Save" meant "Download as file", not "Save edits to the message". Maybe a tooltip or different label (like "Save edits") would help avoid confusion for other users too. Anyway, thanks for the explanation!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#18965