[GH-ISSUE #20365] issue: Floating Quick Actions fails with "NoneType has no attribute 'get'" when parent_message is None #19173

Closed
opened 2026-04-20 01:30:40 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @ledamorita on GitHub (Jan 4, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/20365

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.43

Ollama Version (if applicable)

No response

Operating System

Ubuntu 24.04

Browser (if applicable)

No response

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 I highlight a specific section of text within an AI response and select the "Explain" (or "Ask") button from the floating quick action menu, OpenWebUI should trigger a new generation task. The system should process the selected text and stream a response explaining the context, without throwing any UI errors or backend exceptions.

Image Image

Actual Behavior

Upon clicking the "Explain" button on the highlighted text, the action fails immediately.
UI: A red error toast notification appears at the top right corner saying: "An error occurred while fetching the explanation."

Image Image

Steps to Reproduce

  1. Start a Clean Session: Open OpenWebUI and create a new chat session.
  2. Generate Response: Send a prompt to the model (e.g., "Tell me about the creation of black holes") and wait for the generation to complete.
  3. Select Text: Highlight a specific sentence or paragraph within the AI's response .
  4. Trigger Action: When the floating quick action menu appears, click on the "Explain" button.
  5. Observe Error: Notice that instead of generating a response, the red error toast appears at the top right.
Image Image

Logs & Screenshots

Image Image Image

Additional Information

Root Cause Analysis

After debugging, I found the issue in backend/open_webui/main.py:

Line 1625 - parent_message is set to None:

"parent_message": form_data.pop("parent_message", None),  # ← defaults to None

Line 1648 - Attempts to get parent_message from metadata:

parent_message = metadata.get("parent_message", {})

The Problem: When a key exists in a dictionary with value None, .get(key, default) returns None, NOT the default value.

# Example:
metadata = {"parent_message": None}
parent_message = metadata.get("parent_message", {})  # Returns None, not {}

Line 1649 - Tries to call .get() on None:

parent_message_files = parent_message.get("files", [])  # ❌ AttributeError!

This causes the error because None has no .get() method.

Proposed Solution

Change line 1648 from:

parent_message = metadata.get("parent_message", {})

To:

parent_message = metadata.get("parent_message") or {}

This ensures that if parent_message is None, it will be replaced with an empty dictionary {}.

Originally created by @ledamorita on GitHub (Jan 4, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/20365 ### 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.43 ### Ollama Version (if applicable) _No response_ ### Operating System Ubuntu 24.04 ### Browser (if applicable) _No response_ ### 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 I highlight a specific section of text within an AI response and select the "Explain" (or "Ask") button from the floating quick action menu, OpenWebUI should trigger a new generation task. The system should process the selected text and stream a response explaining the context, without throwing any UI errors or backend exceptions. <img width="3741" height="1953" alt="Image" src="https://github.com/user-attachments/assets/e8cceb3a-9348-44c1-9840-fe02f5c40887" /> <img width="3729" height="1950" alt="Image" src="https://github.com/user-attachments/assets/84bf24f7-12a4-4f22-b297-523f9bb5bb9e" /> ### Actual Behavior Upon clicking the "Explain" button on the highlighted text, the action fails immediately. UI: A red error toast notification appears at the top right corner saying: "An error occurred while fetching the explanation." <img width="3741" height="1953" alt="Image" src="https://github.com/user-attachments/assets/a4e31c6e-fdce-41d6-b6cc-3de3047ba766" /> <img width="3746" height="1943" alt="Image" src="https://github.com/user-attachments/assets/8f8d8129-ab2f-4f5f-9abc-cdce2bb1aa2e" /> ### Steps to Reproduce 1. Start a Clean Session: Open OpenWebUI and create a new chat session. 2. Generate Response: Send a prompt to the model (e.g., "Tell me about the creation of black holes") and wait for the generation to complete. 3. Select Text: Highlight a specific sentence or paragraph within the AI's response . 4. Trigger Action: When the floating quick action menu appears, click on the "Explain" button. 5. Observe Error: Notice that instead of generating a response, the red error toast appears at the top right. <img width="3044" height="1685" alt="Image" src="https://github.com/user-attachments/assets/a65dad34-2285-4559-9e63-8d7f609027f6" /> <img width="1091" height="948" alt="Image" src="https://github.com/user-attachments/assets/963802a2-4129-4fa4-860f-c0a9cf220de3" /> ### Logs & Screenshots <img width="3741" height="1953" alt="Image" src="https://github.com/user-attachments/assets/718ddda9-753d-48d8-a979-96ab24dacf9f" /> <img width="3309" height="1390" alt="Image" src="https://github.com/user-attachments/assets/e2561183-adde-436e-bdc6-e337b49391cd" /> <img width="3314" height="1388" alt="Image" src="https://github.com/user-attachments/assets/544e692e-72b4-4503-af29-e6366a793838" /> ### Additional Information ## Root Cause Analysis After debugging, I found the issue in `backend/open_webui/main.py`: **Line 1625** - `parent_message` is set to `None`: ```python "parent_message": form_data.pop("parent_message", None), # ← defaults to None ``` **Line 1648** - Attempts to get `parent_message` from metadata: ```python parent_message = metadata.get("parent_message", {}) ``` **The Problem**: When a key exists in a dictionary with value `None`, `.get(key, default)` returns `None`, NOT the default value. ```python # Example: metadata = {"parent_message": None} parent_message = metadata.get("parent_message", {}) # Returns None, not {} ``` **Line 1649** - Tries to call `.get()` on `None`: ```python parent_message_files = parent_message.get("files", []) # ❌ AttributeError! ``` This causes the error because `None` has no `.get()` method. ## Proposed Solution Change **line 1648** from: ```python parent_message = metadata.get("parent_message", {}) ``` To: ```python parent_message = metadata.get("parent_message") or {} ``` This ensures that if `parent_message` is `None`, it will be replaced with an empty dictionary `{}`.
GiteaMirror added the bug label 2026-04-20 01:30:40 -05:00
Author
Owner

@Classic298 commented on GitHub (Jan 4, 2026):

Fixed in dev please check for duplicates

<!-- gh-comment-id:3707986738 --> @Classic298 commented on GitHub (Jan 4, 2026): Fixed in dev please check for duplicates
Author
Owner

@ledamorita commented on GitHub (Jan 4, 2026):

Got it, thanks for the fix!

<!-- gh-comment-id:3708001698 --> @ledamorita commented on GitHub (Jan 4, 2026): Got it, thanks for the fix!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#19173