mirror of
https://github.com/open-webui/open-webui.git
synced 2026-03-10 07:43:10 -05:00
issue: TypeError: 'tuple' object does not support item assignment in Action Functions with UserValves (v0.6.15) #5632
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @billijames-911 on GitHub (Jun 25, 2025).
Check Existing Issues
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
README.md.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
File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 212, in run_endpoint_function
File "/app/backend/open_webui/main.py", line 1437, in chat_action
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
@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!