[GH-ISSUE #15040] issue: __user__valves in Actions is updated incorrectly #56111

Closed
opened 2026-05-05 18:43:43 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @stephensrmmartin on GitHub (Jun 16, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/15040

Check Existing Issues

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

Installation Method

Git Clone

Open WebUI Version

v0.6.15

Ollama Version (if applicable)

No response

Operating System

Arch Linux

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 an Action with UserValves is engaged, it should work without error and update the user["valves"] value correctly.

Actual Behavior

An error occurs when using a UserValves-enabled Action.

Jun 16 13:19:23 hwkiller-desktop bash[2824762]: > File "/home/hwkiller/Builds/open-webui/backend/open_webui/utils/chat.py", line 426, in chat_action
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     __user__["valves"] = function_module.UserValves(
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     │                    │               └ <class 'function_example_action.Action.UserValves'>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     │                    └ <function_example_action.Action object at 0x7f9366b79cd0>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     └ ({'id': '9fe88d3e-afa5-48c5-b596-0ed965045716', 'name': 'Stephen Martin', 'email': 'hwkiller@gmail.com', 'role': 'admin', 'pr...
Jun 16 13:19:23 hwkiller-desktop bash[2824762]: TypeError: 'tuple' object does not support item assignment

Steps to Reproduce

  1. Add any Action with UserValves
  2. Press the respective button in anychat
  3. Examine the journal for errors

Logs & Screenshots

Jun 16 13:19:23 hwkiller-desktop bash[2824762]: Traceback (most recent call last):
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:   File "<frozen runpy>", line 198, in _run_module_as_main
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:   File "<frozen runpy>", line 88, in _run_code
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:   File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/uvicorn/__main__.py", line 4, in <module>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     uvicorn.main()
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     │       └ <Command main>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     └ <module 'uvicorn' from '/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/uvicorn/__init__.py'>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:   File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/click/core.py", line 1161, in __call__
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     return self.main(*args, **kwargs)
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:            │    │     │       └ {}
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:            │    │     └ ()
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:            │    └ <function BaseCommand.main at 0x7f95f3d0a520>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:            └ <Command main>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:   File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/click/core.py", line 1082, in main
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     rv = self.invoke(ctx)
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:          │    │      └ <click.core.Context object at 0x7f95f4a388f0>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:          │    └ <function Command.invoke at 0x7f95f3d0b100>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:          └ <Command main>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:   File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/click/core.py", line 1443, in invoke
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     return ctx.invoke(self.callback, **ctx.params)
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:            │   │      │    │           │   └ {'host': '0.0.0.0', 'port': 8080, 'forwarded_allow_ips': '*', 'workers': 1, 'app': 'open_webui.main:app', 'uds': None, 'fd': ...
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:            │   │      │    │           └ <click.core.Context object at 0x7f95f4a388f0>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:            │   │      │    └ <function main at 0x7f95f3a56ac0>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:            │   │      └ <Command main>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:            │   └ <function Context.invoke at 0x7f95f3d09a80>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:            └ <click.core.Context object at 0x7f95f4a388f0>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:   File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/click/core.py", line 788, in invoke
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     return __callback(*args, **kwargs)
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:                        │       └ {'host': '0.0.0.0', 'port': 8080, 'forwarded_allow_ips': '*', 'workers': 1, 'app': 'open_webui.main:app', 'uds': None, 'fd': ...
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:                        └ ()
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:   File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/uvicorn/main.py", line 413, in main
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     run(
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     └ <function run at 0x7f95f3d6cf40>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:   File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/uvicorn/main.py", line 580, in run
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     server.run()
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     │      └ <function Server.run at 0x7f95f3dba7a0>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     └ <uvicorn.server.Server object at 0x7f95f3d37b60>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:   File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/uvicorn/server.py", line 66, in run
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     return asyncio.run(self.serve(sockets=sockets))
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:            │       │   │    │             └ None
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:            │       │   │    └ <function Server.serve at 0x7f95f3dba840>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:            │       │   └ <uvicorn.server.Server object at 0x7f95f3d37b60>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:            │       └ <function run at 0x7f95f4a4a660>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:            └ <module 'asyncio' from '/home/hwkiller/.pyenv/versions/3.12.8/lib/python3.12/asyncio/__init__.py'>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:   File "/home/hwkiller/.pyenv/versions/3.12.8/lib/python3.12/asyncio/runners.py", line 194, in run
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     return runner.run(main)
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:            │      │   └ <coroutine object Server.serve at 0x7f95f3a32500>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:            │      └ <function Runner.run at 0x7f95f3f1a3e0>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:            └ <asyncio.runners.Runner object at 0x7f95f48bec30>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:   File "/home/hwkiller/.pyenv/versions/3.12.8/lib/python3.12/asyncio/runners.py", line 118, in run
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     return self._loop.run_until_complete(task)
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:            │    │     │                  └ <Task pending name='Task-1' coro=<Server.serve() running at /home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3...
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:            │    │     └ <cyfunction Loop.run_until_complete at 0x7f95f3aacc70>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:            │    └ <uvloop.Loop running=True closed=False debug=False>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:            └ <asyncio.runners.Runner object at 0x7f95f48bec30>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:   File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/starlette/middleware/base.py", line 141, in coro
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     await self.app(scope, receive_or_disconnect, send_no_error)
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │    │   │      │                      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.send_no_error at 0x7f9368389c60>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │    │   │      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x7f936838b060>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8080), 'cl...
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │    └ <starlette_compress.CompressMiddleware object at 0x7f936d278270>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           └ <open_webui.main.RedirectMiddleware object at 0x7f9368bec320>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:   File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/starlette_compress/__init__.py", line 92, in __call__
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     return await self._zstd(scope, receive, send)
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:                  │    │     │      │        └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.send_no_error at 0x7f9368389c60>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:                  │    │     │      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x7f936838b060>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:                  │    │     └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8080), 'cl...
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:                  │    └ <member '_zstd' of 'CompressMiddleware' objects>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:                  └ <starlette_compress.CompressMiddleware object at 0x7f936d278270>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:   File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/starlette_compress/_zstd_legacy.py", line 100, in __call__
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     await self.app(scope, receive, wrapper)
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │    │   │      │        └ <function ZstdResponder.__call__.<locals>.wrapper at 0x7f93687db100>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │    │   │      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x7f936838b060>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8080), 'cl...
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │    └ <member 'app' of 'ZstdResponder' objects>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           └ <starlette_compress._zstd_legacy.ZstdResponder object at 0x7f936ec5e280>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:   File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │                            │    │    │     │      │        └ <function ZstdResponder.__call__.<locals>.wrapper at 0x7f93687db100>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │                            │    │    │     │      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x7f936838b060>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │                            │    │    │     └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8080), 'cl...
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │                            │    │    └ <starlette.requests.Request object at 0x7f9367b810a0>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │                            │    └ <fastapi.routing.APIRouter object at 0x7f936a7647a0>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │                            └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0x7f9368b65a60>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           └ <function wrap_app_handling_exceptions at 0x7f95f10b02c0>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:   File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     await app(scope, receive, sender)
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │   │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7f93687a3ba0>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │   │      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x7f936838b060>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8080), 'cl...
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           └ <fastapi.routing.APIRouter object at 0x7f936a7647a0>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:   File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/starlette/routing.py", line 715, in __call__
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     await self.middleware_stack(scope, receive, send)
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │    │                │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7f93687a3ba0>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │    │                │      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x7f936838b060>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │    │                └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8080), 'cl...
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │    └ <bound method Router.app of <fastapi.routing.APIRouter object at 0x7f936a7647a0>>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           └ <fastapi.routing.APIRouter object at 0x7f936a7647a0>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:   File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/starlette/routing.py", line 735, in app
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     await route.handle(scope, receive, send)
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │     │      │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7f93687a3ba0>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │     │      │      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x7f936838b060>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │     │      └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8080), 'cl...
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │     └ <function Route.handle at 0x7f95f10b19e0>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           └ APIRoute(path='/api/chat/actions/{action_id}', name='chat_action', methods=['POST'])
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:   File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/starlette/routing.py", line 288, in handle
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     await self.app(scope, receive, send)
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │    │   │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7f93687a3ba0>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │    │   │      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x7f936838b060>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8080), 'cl...
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │    └ <function request_response.<locals>.app at 0x7f9368b56fc0>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           └ APIRoute(path='/api/chat/actions/{action_id}', name='chat_action', methods=['POST'])
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:   File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/starlette/routing.py", line 76, in app
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     await wrap_app_handling_exceptions(app, request)(scope, receive, send)
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │                            │    │        │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7f93687a3ba0>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │                            │    │        │      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x7f936838b060>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │                            │    │        └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8080), 'cl...
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │                            │    └ <starlette.requests.Request object at 0x7f9368333cb0>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │                            └ <function request_response.<locals>.app.<locals>.app at 0x7f936731e700>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           └ <function wrap_app_handling_exceptions at 0x7f95f10b02c0>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:   File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     await app(scope, receive, sender)
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │   │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7f936731e5c0>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │   │      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x7f936838b060>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8080), 'cl...
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:           └ <function request_response.<locals>.app.<locals>.app at 0x7f936731e700>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:   File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/starlette/routing.py", line 73, in app
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     response = await f(request)
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:                      │ └ <starlette.requests.Request object at 0x7f9368333cb0>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:                      └ <function get_request_handler.<locals>.app at 0x7f9368b56f20>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:   File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/fastapi/routing.py", line 301, in app
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     raw_response = await run_endpoint_function(
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:                          └ <function run_endpoint_function at 0x7f95f10b14e0>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:   File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/fastapi/routing.py", line 212, in run_endpoint_function
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     return await dependant.call(**values)
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:                  │         │      └ {'user': UserModel(id='9fe88d3e-afa5-48c5-b596-0ed965045716', name='Stephen Martin', email='hwkiller@gmail.com', role='admin'...
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:                  │         └ <function chat_action at 0x7f9368b56520>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:                  └ Dependant(path_params=[ModelField(field_info=Path(PydanticUndefined), name='action_id', mode='validation')], query_params=[],...
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:   File "/home/hwkiller/Builds/open-webui/backend/open_webui/main.py", line 1437, in chat_action
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     return await chat_action_handler(request, action_id, form_data, user)
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:                  │                   │        │          │          └ UserModel(id='9fe88d3e-afa5-48c5-b596-0ed965045716', name='Stephen Martin', email='hwkiller@gmail.com', role='admin', profile...
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:                  │                   │        │          └ {'model': 'default:latest', 'messages': [{'id': '4a2845c4-f404-4d13-8792-4b0aadf9811c', 'role': 'user', 'content': 'List all ...
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:                  │                   │        └ 'example_action'
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:                  │                   └ <starlette.requests.Request object at 0x7f9368333cb0>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:                  └ <function chat_action at 0x7f936d8994e0>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]: > File "/home/hwkiller/Builds/open-webui/backend/open_webui/utils/chat.py", line 426, in chat_action
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     __user__["valves"] = function_module.UserValves(
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     │                    │               └ <class 'function_example_action.Action.UserValves'>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     │                    └ <function_example_action.Action object at 0x7f9366b79cd0>
Jun 16 13:19:23 hwkiller-desktop bash[2824762]:     └ ({'id': '9fe88d3e-afa5-48c5-b596-0ed965045716', 'name': 'Stephen Martin', 'email': 'hwkiller@gmail.com', 'role': 'admin', 'pr...
Jun 16 13:19:23 hwkiller-desktop bash[2824762]: TypeError: 'tuple' object does not support item assignment
Jun 16 13:19:28 hwkiller-desktop bash[2824762]: action:function_example_action
Jun 16 13:19:28 hwkiller-desktop bash[2824762]: Testing again

Additional Information

I discovered this when trying to get the following Action to work without error: https://openwebui.com/f/pad4651/add_to_memories_action_button

The log suggested that an error was occurring, and I traced it to the aforementioned pattern.

Using the example action, with an added uservalves, also produces the issue:

"""
title: Example Action
author: open-webui
author_url: https://github.com/open-webui
funding_url: https://github.com/open-webui
version: 0.1.0
required_open_webui_version: 0.3.9
"""

from pydantic import BaseModel, Field
from typing import Optional, Union, Generator, Iterator

import os
import requests
import asyncio


class Action:
    class Valves(BaseModel):
        pass

    class UserValves(BaseModel):
        test: bool = Field(
            default=False, description="Pointless uservalve to demonstrate bug"
        )

    def __init__(self):
        self.valves = self.Valves()
        pass

    async def action(
        self,
        body: dict,
        __user__=None,
        __event_emitter__=None,
        __event_call__=None,
    ) -> Optional[dict]:
        print(f"action:{__name__}")

        response = await __event_call__(
            {
                "type": "input",
                "data": {
                    "title": "write a message",
                    "message": "here write a message to append",
                    "placeholder": "enter your message",
                },
            }
        )
        print(response)

        if __event_emitter__:
            await __event_emitter__(
                {
                    "type": "status",
                    "data": {"description": "adding message", "done": False},
                }
            )
            await asyncio.sleep(1)
            await __event_emitter__({"type": "message", "data": {"content": response}})
            await __event_emitter__(
                {
                    "type": "status",
                    "data": {"description": "added message", "done": True},
                }
            )

Originally created by @stephensrmmartin on GitHub (Jun 16, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/15040 ### Check Existing Issues - [x] I have searched the existing issues and discussions. - [x] I am using the latest version of Open WebUI. ### Installation Method Git Clone ### Open WebUI Version v0.6.15 ### Ollama Version (if applicable) _No response_ ### Operating System Arch Linux ### 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 an Action with UserValves is engaged, it should work without error and update the __user__["valves"] value correctly. ### Actual Behavior An error occurs when using a UserValves-enabled Action. ``` Jun 16 13:19:23 hwkiller-desktop bash[2824762]: > File "/home/hwkiller/Builds/open-webui/backend/open_webui/utils/chat.py", line 426, in chat_action Jun 16 13:19:23 hwkiller-desktop bash[2824762]: __user__["valves"] = function_module.UserValves( Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ └ <class 'function_example_action.Action.UserValves'> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ └ <function_example_action.Action object at 0x7f9366b79cd0> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: └ ({'id': '9fe88d3e-afa5-48c5-b596-0ed965045716', 'name': 'Stephen Martin', 'email': 'hwkiller@gmail.com', 'role': 'admin', 'pr... Jun 16 13:19:23 hwkiller-desktop bash[2824762]: TypeError: 'tuple' object does not support item assignment ``` ### Steps to Reproduce 1. Add any Action with UserValves 2. Press the respective button in anychat 3. Examine the journal for errors ### Logs & Screenshots ``` Jun 16 13:19:23 hwkiller-desktop bash[2824762]: Traceback (most recent call last): Jun 16 13:19:23 hwkiller-desktop bash[2824762]: File "<frozen runpy>", line 198, in _run_module_as_main Jun 16 13:19:23 hwkiller-desktop bash[2824762]: File "<frozen runpy>", line 88, in _run_code Jun 16 13:19:23 hwkiller-desktop bash[2824762]: File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/uvicorn/__main__.py", line 4, in <module> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: uvicorn.main() Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ └ <Command main> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: └ <module 'uvicorn' from '/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/uvicorn/__init__.py'> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/click/core.py", line 1161, in __call__ Jun 16 13:19:23 hwkiller-desktop bash[2824762]: return self.main(*args, **kwargs) Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ └ {} Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ └ () Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ └ <function BaseCommand.main at 0x7f95f3d0a520> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: └ <Command main> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/click/core.py", line 1082, in main Jun 16 13:19:23 hwkiller-desktop bash[2824762]: rv = self.invoke(ctx) Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ └ <click.core.Context object at 0x7f95f4a388f0> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ └ <function Command.invoke at 0x7f95f3d0b100> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: └ <Command main> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/click/core.py", line 1443, in invoke Jun 16 13:19:23 hwkiller-desktop bash[2824762]: return ctx.invoke(self.callback, **ctx.params) Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ │ │ └ {'host': '0.0.0.0', 'port': 8080, 'forwarded_allow_ips': '*', 'workers': 1, 'app': 'open_webui.main:app', 'uds': None, 'fd': ... Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ │ └ <click.core.Context object at 0x7f95f4a388f0> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ └ <function main at 0x7f95f3a56ac0> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ └ <Command main> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ └ <function Context.invoke at 0x7f95f3d09a80> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: └ <click.core.Context object at 0x7f95f4a388f0> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/click/core.py", line 788, in invoke Jun 16 13:19:23 hwkiller-desktop bash[2824762]: return __callback(*args, **kwargs) Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ └ {'host': '0.0.0.0', 'port': 8080, 'forwarded_allow_ips': '*', 'workers': 1, 'app': 'open_webui.main:app', 'uds': None, 'fd': ... Jun 16 13:19:23 hwkiller-desktop bash[2824762]: └ () Jun 16 13:19:23 hwkiller-desktop bash[2824762]: File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/uvicorn/main.py", line 413, in main Jun 16 13:19:23 hwkiller-desktop bash[2824762]: run( Jun 16 13:19:23 hwkiller-desktop bash[2824762]: └ <function run at 0x7f95f3d6cf40> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/uvicorn/main.py", line 580, in run Jun 16 13:19:23 hwkiller-desktop bash[2824762]: server.run() Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ └ <function Server.run at 0x7f95f3dba7a0> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: └ <uvicorn.server.Server object at 0x7f95f3d37b60> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/uvicorn/server.py", line 66, in run Jun 16 13:19:23 hwkiller-desktop bash[2824762]: return asyncio.run(self.serve(sockets=sockets)) Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ │ └ None Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ └ <function Server.serve at 0x7f95f3dba840> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ └ <uvicorn.server.Server object at 0x7f95f3d37b60> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ └ <function run at 0x7f95f4a4a660> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: └ <module 'asyncio' from '/home/hwkiller/.pyenv/versions/3.12.8/lib/python3.12/asyncio/__init__.py'> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: File "/home/hwkiller/.pyenv/versions/3.12.8/lib/python3.12/asyncio/runners.py", line 194, in run Jun 16 13:19:23 hwkiller-desktop bash[2824762]: return runner.run(main) Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ └ <coroutine object Server.serve at 0x7f95f3a32500> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ └ <function Runner.run at 0x7f95f3f1a3e0> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: └ <asyncio.runners.Runner object at 0x7f95f48bec30> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: File "/home/hwkiller/.pyenv/versions/3.12.8/lib/python3.12/asyncio/runners.py", line 118, in run Jun 16 13:19:23 hwkiller-desktop bash[2824762]: return self._loop.run_until_complete(task) Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ └ <Task pending name='Task-1' coro=<Server.serve() running at /home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3... Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ └ <cyfunction Loop.run_until_complete at 0x7f95f3aacc70> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ └ <uvloop.Loop running=True closed=False debug=False> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: └ <asyncio.runners.Runner object at 0x7f95f48bec30> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/starlette/middleware/base.py", line 141, in coro Jun 16 13:19:23 hwkiller-desktop bash[2824762]: await self.app(scope, receive_or_disconnect, send_no_error) Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.send_no_error at 0x7f9368389c60> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x7f936838b060> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8080), 'cl... Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ └ <starlette_compress.CompressMiddleware object at 0x7f936d278270> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: └ <open_webui.main.RedirectMiddleware object at 0x7f9368bec320> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/starlette_compress/__init__.py", line 92, in __call__ Jun 16 13:19:23 hwkiller-desktop bash[2824762]: return await self._zstd(scope, receive, send) Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.send_no_error at 0x7f9368389c60> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x7f936838b060> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8080), 'cl... Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ └ <member '_zstd' of 'CompressMiddleware' objects> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: └ <starlette_compress.CompressMiddleware object at 0x7f936d278270> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/starlette_compress/_zstd_legacy.py", line 100, in __call__ Jun 16 13:19:23 hwkiller-desktop bash[2824762]: await self.app(scope, receive, wrapper) Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ │ └ <function ZstdResponder.__call__.<locals>.wrapper at 0x7f93687db100> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x7f936838b060> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8080), 'cl... Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ └ <member 'app' of 'ZstdResponder' objects> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: └ <starlette_compress._zstd_legacy.ZstdResponder object at 0x7f936ec5e280> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 62, in __call__ Jun 16 13:19:23 hwkiller-desktop bash[2824762]: await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ │ │ │ └ <function ZstdResponder.__call__.<locals>.wrapper at 0x7f93687db100> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x7f936838b060> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8080), 'cl... Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ └ <starlette.requests.Request object at 0x7f9367b810a0> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ └ <fastapi.routing.APIRouter object at 0x7f936a7647a0> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0x7f9368b65a60> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: └ <function wrap_app_handling_exceptions at 0x7f95f10b02c0> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app Jun 16 13:19:23 hwkiller-desktop bash[2824762]: await app(scope, receive, sender) Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7f93687a3ba0> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x7f936838b060> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8080), 'cl... Jun 16 13:19:23 hwkiller-desktop bash[2824762]: └ <fastapi.routing.APIRouter object at 0x7f936a7647a0> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/starlette/routing.py", line 715, in __call__ Jun 16 13:19:23 hwkiller-desktop bash[2824762]: await self.middleware_stack(scope, receive, send) Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ │ └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7f93687a3ba0> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x7f936838b060> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8080), 'cl... Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ └ <bound method Router.app of <fastapi.routing.APIRouter object at 0x7f936a7647a0>> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: └ <fastapi.routing.APIRouter object at 0x7f936a7647a0> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/starlette/routing.py", line 735, in app Jun 16 13:19:23 hwkiller-desktop bash[2824762]: await route.handle(scope, receive, send) Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ │ └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7f93687a3ba0> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x7f936838b060> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8080), 'cl... Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ └ <function Route.handle at 0x7f95f10b19e0> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: └ APIRoute(path='/api/chat/actions/{action_id}', name='chat_action', methods=['POST']) Jun 16 13:19:23 hwkiller-desktop bash[2824762]: File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/starlette/routing.py", line 288, in handle Jun 16 13:19:23 hwkiller-desktop bash[2824762]: await self.app(scope, receive, send) Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ │ └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7f93687a3ba0> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x7f936838b060> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8080), 'cl... Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ └ <function request_response.<locals>.app at 0x7f9368b56fc0> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: └ APIRoute(path='/api/chat/actions/{action_id}', name='chat_action', methods=['POST']) Jun 16 13:19:23 hwkiller-desktop bash[2824762]: File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/starlette/routing.py", line 76, in app Jun 16 13:19:23 hwkiller-desktop bash[2824762]: await wrap_app_handling_exceptions(app, request)(scope, receive, send) Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ │ │ └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7f93687a3ba0> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x7f936838b060> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8080), 'cl... Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ └ <starlette.requests.Request object at 0x7f9368333cb0> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ └ <function request_response.<locals>.app.<locals>.app at 0x7f936731e700> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: └ <function wrap_app_handling_exceptions at 0x7f95f10b02c0> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app Jun 16 13:19:23 hwkiller-desktop bash[2824762]: await app(scope, receive, sender) Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7f936731e5c0> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x7f936838b060> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('127.0.0.1', 8080), 'cl... Jun 16 13:19:23 hwkiller-desktop bash[2824762]: └ <function request_response.<locals>.app.<locals>.app at 0x7f936731e700> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/starlette/routing.py", line 73, in app Jun 16 13:19:23 hwkiller-desktop bash[2824762]: response = await f(request) Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ └ <starlette.requests.Request object at 0x7f9368333cb0> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: └ <function get_request_handler.<locals>.app at 0x7f9368b56f20> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/fastapi/routing.py", line 301, in app Jun 16 13:19:23 hwkiller-desktop bash[2824762]: raw_response = await run_endpoint_function( Jun 16 13:19:23 hwkiller-desktop bash[2824762]: └ <function run_endpoint_function at 0x7f95f10b14e0> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: File "/home/hwkiller/.pyenv/versions/3.12.8/envs/open-webui/lib/python3.12/site-packages/fastapi/routing.py", line 212, in run_endpoint_function Jun 16 13:19:23 hwkiller-desktop bash[2824762]: return await dependant.call(**values) Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ └ {'user': UserModel(id='9fe88d3e-afa5-48c5-b596-0ed965045716', name='Stephen Martin', email='hwkiller@gmail.com', role='admin'... Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ └ <function chat_action at 0x7f9368b56520> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: └ Dependant(path_params=[ModelField(field_info=Path(PydanticUndefined), name='action_id', mode='validation')], query_params=[],... Jun 16 13:19:23 hwkiller-desktop bash[2824762]: File "/home/hwkiller/Builds/open-webui/backend/open_webui/main.py", line 1437, in chat_action Jun 16 13:19:23 hwkiller-desktop bash[2824762]: return await chat_action_handler(request, action_id, form_data, user) Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ │ └ UserModel(id='9fe88d3e-afa5-48c5-b596-0ed965045716', name='Stephen Martin', email='hwkiller@gmail.com', role='admin', profile... Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ │ └ {'model': 'default:latest', 'messages': [{'id': '4a2845c4-f404-4d13-8792-4b0aadf9811c', 'role': 'user', 'content': 'List all ... Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ └ 'example_action' Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ └ <starlette.requests.Request object at 0x7f9368333cb0> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: └ <function chat_action at 0x7f936d8994e0> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: > File "/home/hwkiller/Builds/open-webui/backend/open_webui/utils/chat.py", line 426, in chat_action Jun 16 13:19:23 hwkiller-desktop bash[2824762]: __user__["valves"] = function_module.UserValves( Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ │ └ <class 'function_example_action.Action.UserValves'> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: │ └ <function_example_action.Action object at 0x7f9366b79cd0> Jun 16 13:19:23 hwkiller-desktop bash[2824762]: └ ({'id': '9fe88d3e-afa5-48c5-b596-0ed965045716', 'name': 'Stephen Martin', 'email': 'hwkiller@gmail.com', 'role': 'admin', 'pr... Jun 16 13:19:23 hwkiller-desktop bash[2824762]: TypeError: 'tuple' object does not support item assignment Jun 16 13:19:28 hwkiller-desktop bash[2824762]: action:function_example_action Jun 16 13:19:28 hwkiller-desktop bash[2824762]: Testing again ``` ### Additional Information I discovered this when trying to get the following Action to work without error: https://openwebui.com/f/pad4651/add_to_memories_action_button The log suggested that an error was occurring, and I traced it to the aforementioned pattern. Using the example action, with an added uservalves, also produces the issue: ```python """ title: Example Action author: open-webui author_url: https://github.com/open-webui funding_url: https://github.com/open-webui version: 0.1.0 required_open_webui_version: 0.3.9 """ from pydantic import BaseModel, Field from typing import Optional, Union, Generator, Iterator import os import requests import asyncio class Action: class Valves(BaseModel): pass class UserValves(BaseModel): test: bool = Field( default=False, description="Pointless uservalve to demonstrate bug" ) def __init__(self): self.valves = self.Valves() pass async def action( self, body: dict, __user__=None, __event_emitter__=None, __event_call__=None, ) -> Optional[dict]: print(f"action:{__name__}") response = await __event_call__( { "type": "input", "data": { "title": "write a message", "message": "here write a message to append", "placeholder": "enter your message", }, } ) print(response) if __event_emitter__: await __event_emitter__( { "type": "status", "data": {"description": "adding message", "done": False}, } ) await asyncio.sleep(1) await __event_emitter__({"type": "message", "data": {"content": response}}) await __event_emitter__( { "type": "status", "data": {"description": "added message", "done": True}, } ) ```
GiteaMirror added the bug label 2026-05-05 18:43:43 -05:00
Author
Owner

@stephensrmmartin commented on GitHub (Jun 16, 2025):

Note that it appears to be due to this outdated (?) pattern:

            if "__user__" in sig.parameters:
                __user__ = (user.model_dump() if isinstance(user, UserModel) else {},)

                try:
                    if hasattr(function_module, "UserValves"):
                        __user__["valves"] = function_module.UserValves(
                            **Functions.get_user_valves_by_id_and_user_id(
                                action_id, user.id
                            )
                        )

In other areas of the repo, similar calls look like:

            if "__user__" in sig.parameters:
                if hasattr(function_module, "UserValves"):
                    try:
                        params["__user__"]["valves"] = function_module.UserValves(
                            **Functions.get_user_valves_by_id_and_user_id(
                                filter_id, params["__user__"]["id"]
                            )
                        )
                    except Exception as e:
                        log.exception(f"Failed to get user values: {e}")

<!-- gh-comment-id:2978033321 --> @stephensrmmartin commented on GitHub (Jun 16, 2025): Note that it appears to be due to this outdated (?) pattern: ```python if "__user__" in sig.parameters: __user__ = (user.model_dump() if isinstance(user, UserModel) else {},) try: if hasattr(function_module, "UserValves"): __user__["valves"] = function_module.UserValves( **Functions.get_user_valves_by_id_and_user_id( action_id, user.id ) ) ``` In other areas of the repo, similar calls look like: ```python if "__user__" in sig.parameters: if hasattr(function_module, "UserValves"): try: params["__user__"]["valves"] = function_module.UserValves( **Functions.get_user_valves_by_id_and_user_id( filter_id, params["__user__"]["id"] ) ) except Exception as e: log.exception(f"Failed to get user values: {e}") ```
Author
Owner

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

Good catch, Addressed in dev with 0134b5eca4f458d9d5f025d393b7f273051a9643!

<!-- gh-comment-id:2982909998 --> @tjbck commented on GitHub (Jun 18, 2025): Good catch, Addressed in dev with 0134b5eca4f458d9d5f025d393b7f273051a9643!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#56111