issue: TypeError: 'tuple' object does not support item assignment in Action Functions with UserValves (v0.6.15) #5632

Closed
opened 2025-11-11 16:26:49 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @billijames-911 on GitHub (Jun 25, 2025).

Check Existing Issues

  • I have searched the existing issues and discussions.
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

0.6.15

Ollama Version (if applicable)

No response

Operating System

Windows 11

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

Expected Behavior:
The action function should execute successfully, process its logic, and interact with UserValves settings without encountering a TypeError. The user["valves"] should be a mutable object (e.g., a dictionary or a Pydantic model instance) allowing for item assignment.

Actual Behavior

2025-06-25 00:04:25.327 | ERROR | open_webui.utils.chat:chat_action:432 - Failed to get user values: 'tuple' object does not support item assignment - {}
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/usr/local/lib/python3.11/site-packages/uvicorn/main.py", line 4, in
uvicorn.main()
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1442, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1363, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1226, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 794, in invoke
# ... (rest of traceback leading to open_webui.utils.chat)
File "/app/backend/open_webui/utils/chat.py", line 432, in chat_action
user["valves"] = function_module.UserValves(
TypeError: 'tuple' object does not support item assignment

Steps to Reproduce

Steps to Reproduce:
Prerequisites:

Ensure Docker and Docker Compose are installed on your system.
Familiarity with basic terminal/command prompt commands.
(Optional, but recommended for full testing): An API key for OpenAI or Anthropic, or a local Ollama instance running if you intend to test actions that make LLM calls.
Set up OpenWebUI (Clean Installation of v0.6.15):

If OpenWebUI is already running:
Navigate to your OpenWebUI installation directory (where your docker-compose.yml file is, or where you typically manage your open-webui container).
Stop and remove any existing OpenWebUI containers and its associated volume to ensure a clean slate (this will delete all existing chat history and data – BACK UP if needed):
Bash

docker compose down -v

OR (if using direct docker run):

docker stop open-webui

docker rm open-webui

docker volume rm open-webui # WARNING: This deletes all data!

(Optional, but highly recommended for thorough cleanup): Prune all unused Docker data. Use with caution, as this removes ALL unused Docker objects.
Bash

docker system prune -a --volumes
Install a fresh instance of OpenWebUI v0.6.15:
Create a new, empty directory for OpenWebUI (e.g., mkdir open-webui-test && cd open-webui-test).
Create a docker-compose.yml file with the following content (or use an equivalent docker run command):
YAML

version: '3.8'
services:
open-webui:
image: ghcr.io/open-webui/open-webui:v0.6.15 # Explicitly specify the version
container_name: open-webui
ports:
- "3000:8080"
volumes:
- open-webui-data:/app/backend/data # Persistent volume for data
environment:
# Ensure this is set for stable sessions, use a strong random key
- WEBUI_SECRET_KEY=your_secure_random_secret_key_here
# Optional: If connecting to local Ollama
# - OLLAMA_BASE_URL=http://host.docker.internal:11434
restart: always
volumes:
open-webui-data:
Save the file.
Pull the specific Docker image and start the container:
Bash

docker compose pull
docker compose up -d
Wait a few minutes for the container to start.
Access OpenWebUI and Create User:

Open your web browser and navigate to http://localhost:3000.
Register a new user account (e.g., testuser / password). Log in.
Install Action Functions (Select one to test at a time):

Open your terminal/file explorer and locate the open-webui-data volume's mounted path (e.g., your-open-webui-test-folder/open-webui-data or a Docker volume path if not directly mounted). Inside, navigate to or create the functions directory: /path/to/open-webui-data/_data/functions/.
Choose one of the following failing action functions and paste its code into a new .py file (e.g., add_to_memory_action.py, smart_summarizer.py, message_processor.py, explain_like_im_5.py) inside this functions directory.
For "Add to Memory Action Button": Use the original, unmodified code you previously provided (before any commenting out).
For "Smart Summarizer": Use the original code you provided.
For "Message Processor Action": Use the original code you provided.
For "Explain Like I'm 5 (Enhanced)": Use the original code you provided.
Restart OpenWebUI after adding the function file:
Bash

docker compose restart open-webui
Enable the Action Function in OpenWebUI:

Log back into OpenWebUI (http://localhost:3000).
Go to Admin Settings (⚙️) -> Functions.
Find the newly added action (e.g., "Add to Memory Action Button," "Smart Summarizer," etc.).
Toggle the switch to "Enabled".
(Optional, but good for testing): Go to Admin Settings (⚙️) -> Models, select the model you are using, and ensure the function is also enabled for that specific model, or enable functions globally if that option is available.
Trigger the Action and Observe Error:

Go to a chat session.
Send a message to any LLM (e.g., "Hello").
Click the action button that appears under the message (for the action you just enabled).
Immediately observe the terminal where your Docker Compose logs are running. You should see the TypeError: 'tuple' object does not support item assignment traceback.
Also, note if any expected UI notifications or changes from the action itself are missing or incomplete.

Logs & Screenshots

raw_response = await run_endpoint_function(

                     └ <function run_endpoint_function at 0x7f31316179c0>

File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 212, in run_endpoint_function

return await dependant.call(**values)

             │         │      └ {'user': UserModel(id='164a0c6f-4521-4d41-b9ff-a5c11916e0df', name='Bilal ejaz', email='bilalejazdeen@gmail.com', role='admin...

             │         └ <function chat_action at 0x7f30d39f74c0>

             └ Dependant(path_params=[ModelField(field_info=Path(PydanticUndefined), name='action_id', mode='validation')], query_params=[],...

File "/app/backend/open_webui/main.py", line 1437, in chat_action

return await chat_action_handler(request, action_id, form_data, user)

             │                   │        │          │          └ UserModel(id='164a0c6f-4521-4d41-b9ff-a5c11916e0df', name='Bilal ejaz', email='bilalejazdeen@gmail.com', role='admin', profil...

             │                   │        │          └ {'model': 'deepseek-r1:1.5b', 'messages': [{'id': '40df1a26-e842-4d4b-bcd4-d41c0619c0ca', 'role': 'user', 'content': 'Hi I am...

             │                   │        └ 'add_to_memories_action_button'

             │                   └ <starlette.requests.Request object at 0x7f30ca143fd0>

             └ <function chat_action at 0x7f30ffb4ce00>

File "/app/backend/open_webui/utils/chat.py", line 426, in chat_action

__user__["valves"] = function_module.UserValves(

│                    │               └ <class 'function_add_to_memories_action_button.Action.UserValves'>

│                    └ <function_add_to_memories_action_button.Action object at 0x7f30ca12dad0>

└ ({'id': '164a0c6f-4521-4d41-b9ff-a5c11916e0df', 'name': 'Bilal ejaz', 'email': 'bilalejazdeen@gmail.com', 'role': 'admin', 'p...

TypeError: 'tuple' object does not support item assignment

action:function_add_to_memories_action_button

2025-06-25 00:24:41.533 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 192.168.65.1:47899 - "POST /api/chat/actions/add_to_memories_action_button HTTP/1.1" 200 - {}

2025-06-25 00:24:41.603 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 192.168.65.1:47899 - "POST /api/v1/chats/6ac3370e-3e0a-4499-8792-68f516f10ea7 HTTP/1.1" 200 - {}

2025-06-25 00:24:41.630 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 192.168.65.1:47899 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 - {}

Additional Information

No response

Originally created by @billijames-911 on GitHub (Jun 25, 2025). ### Check Existing Issues - [x] I have searched the existing issues and discussions. - [x] I am using the latest version of Open WebUI. ### Installation Method Docker ### Open WebUI Version 0.6.15 ### Ollama Version (if applicable) _No response_ ### Operating System Windows 11 ### 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 Expected Behavior: The action function should execute successfully, process its logic, and interact with UserValves settings without encountering a TypeError. The __user__["valves"] should be a mutable object (e.g., a dictionary or a Pydantic model instance) allowing for item assignment. ### Actual Behavior 2025-06-25 00:04:25.327 | ERROR | open_webui.utils.chat:chat_action:432 - Failed to get user values: 'tuple' object does not support item assignment - {} Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/usr/local/lib/python3.11/site-packages/uvicorn/__main__.py", line 4, in <module> uvicorn.main() File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1442, in __call__ return self.main(*args, **kwargs) File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1363, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1226, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/local/lib/python3.11/site-packages/click/core.py", line 794, in invoke # ... (rest of traceback leading to open_webui.utils.chat) File "/app/backend/open_webui/utils/chat.py", line 432, in chat_action __user__["valves"] = function_module.UserValves( TypeError: 'tuple' object does not support item assignment ### Steps to Reproduce Steps to Reproduce: Prerequisites: Ensure Docker and Docker Compose are installed on your system. Familiarity with basic terminal/command prompt commands. (Optional, but recommended for full testing): An API key for OpenAI or Anthropic, or a local Ollama instance running if you intend to test actions that make LLM calls. Set up OpenWebUI (Clean Installation of v0.6.15): If OpenWebUI is already running: Navigate to your OpenWebUI installation directory (where your docker-compose.yml file is, or where you typically manage your open-webui container). Stop and remove any existing OpenWebUI containers and its associated volume to ensure a clean slate (this will delete all existing chat history and data – BACK UP if needed): Bash docker compose down -v # OR (if using direct docker run): # docker stop open-webui # docker rm open-webui # docker volume rm open-webui # WARNING: This deletes all data! (Optional, but highly recommended for thorough cleanup): Prune all unused Docker data. Use with caution, as this removes ALL unused Docker objects. Bash docker system prune -a --volumes Install a fresh instance of OpenWebUI v0.6.15: Create a new, empty directory for OpenWebUI (e.g., mkdir open-webui-test && cd open-webui-test). Create a docker-compose.yml file with the following content (or use an equivalent docker run command): YAML version: '3.8' services: open-webui: image: ghcr.io/open-webui/open-webui:v0.6.15 # Explicitly specify the version container_name: open-webui ports: - "3000:8080" volumes: - open-webui-data:/app/backend/data # Persistent volume for data environment: # Ensure this is set for stable sessions, use a strong random key - WEBUI_SECRET_KEY=your_secure_random_secret_key_here # Optional: If connecting to local Ollama # - OLLAMA_BASE_URL=http://host.docker.internal:11434 restart: always volumes: open-webui-data: Save the file. Pull the specific Docker image and start the container: Bash docker compose pull docker compose up -d Wait a few minutes for the container to start. Access OpenWebUI and Create User: Open your web browser and navigate to http://localhost:3000. Register a new user account (e.g., testuser / password). Log in. Install Action Functions (Select one to test at a time): Open your terminal/file explorer and locate the open-webui-data volume's mounted path (e.g., your-open-webui-test-folder/open-webui-data or a Docker volume path if not directly mounted). Inside, navigate to or create the functions directory: /path/to/open-webui-data/_data/functions/. Choose one of the following failing action functions and paste its code into a new .py file (e.g., add_to_memory_action.py, smart_summarizer.py, message_processor.py, explain_like_im_5.py) inside this functions directory. For "Add to Memory Action Button": Use the original, unmodified code you previously provided (before any commenting out). For "Smart Summarizer": Use the original code you provided. For "Message Processor Action": Use the original code you provided. For "Explain Like I'm 5 (Enhanced)": Use the original code you provided. Restart OpenWebUI after adding the function file: Bash docker compose restart open-webui Enable the Action Function in OpenWebUI: Log back into OpenWebUI (http://localhost:3000). Go to Admin Settings (⚙️) -> Functions. Find the newly added action (e.g., "Add to Memory Action Button," "Smart Summarizer," etc.). Toggle the switch to "Enabled". (Optional, but good for testing): Go to Admin Settings (⚙️) -> Models, select the model you are using, and ensure the function is also enabled for that specific model, or enable functions globally if that option is available. Trigger the Action and Observe Error: Go to a chat session. Send a message to any LLM (e.g., "Hello"). Click the action button that appears under the message (for the action you just enabled). Immediately observe the terminal where your Docker Compose logs are running. You should see the TypeError: 'tuple' object does not support item assignment traceback. Also, note if any expected UI notifications or changes from the action itself are missing or incomplete. ### Logs & Screenshots raw_response = await run_endpoint_function( └ <function run_endpoint_function at 0x7f31316179c0> File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 212, in run_endpoint_function return await dependant.call(**values) │ │ └ {'user': UserModel(id='164a0c6f-4521-4d41-b9ff-a5c11916e0df', name='Bilal ejaz', email='bilalejazdeen@gmail.com', role='admin... │ └ <function chat_action at 0x7f30d39f74c0> └ Dependant(path_params=[ModelField(field_info=Path(PydanticUndefined), name='action_id', mode='validation')], query_params=[],... File "/app/backend/open_webui/main.py", line 1437, in chat_action return await chat_action_handler(request, action_id, form_data, user) │ │ │ │ └ UserModel(id='164a0c6f-4521-4d41-b9ff-a5c11916e0df', name='Bilal ejaz', email='bilalejazdeen@gmail.com', role='admin', profil... │ │ │ └ {'model': 'deepseek-r1:1.5b', 'messages': [{'id': '40df1a26-e842-4d4b-bcd4-d41c0619c0ca', 'role': 'user', 'content': 'Hi I am... │ │ └ 'add_to_memories_action_button' │ └ <starlette.requests.Request object at 0x7f30ca143fd0> └ <function chat_action at 0x7f30ffb4ce00> > File "/app/backend/open_webui/utils/chat.py", line 426, in chat_action __user__["valves"] = function_module.UserValves( │ │ └ <class 'function_add_to_memories_action_button.Action.UserValves'> │ └ <function_add_to_memories_action_button.Action object at 0x7f30ca12dad0> └ ({'id': '164a0c6f-4521-4d41-b9ff-a5c11916e0df', 'name': 'Bilal ejaz', 'email': 'bilalejazdeen@gmail.com', 'role': 'admin', 'p... TypeError: 'tuple' object does not support item assignment action:function_add_to_memories_action_button 2025-06-25 00:24:41.533 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 192.168.65.1:47899 - "POST /api/chat/actions/add_to_memories_action_button HTTP/1.1" 200 - {} 2025-06-25 00:24:41.603 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 192.168.65.1:47899 - "POST /api/v1/chats/6ac3370e-3e0a-4499-8792-68f516f10ea7 HTTP/1.1" 200 - {} 2025-06-25 00:24:41.630 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 192.168.65.1:47899 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 - {} ### Additional Information _No response_
GiteaMirror added the bug label 2025-11-11 16:26:49 -06:00
Author
Owner

@tjbck commented on GitHub (Jun 25, 2025):

This should've been addressed in dev, PLEASE check for existing issues/discussions before creating one.

If this has not been addressed in dev, please let us know!

@tjbck commented on GitHub (Jun 25, 2025): This should've been addressed in dev, PLEASE check for existing issues/discussions before creating one. If this has not been addressed in dev, please let us know!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#5632