mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-08 12:58:11 -05:00
[GH-ISSUE #16425] issue: All models return "cannot access local variable 'model_id' where it is not associated with a value" after update to 0.6.20 #17899
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 @thr-4 on GitHub (Aug 10, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/16425
Check Existing Issues
Installation Method
Pip Install
Open WebUI Version
0.6.20
Ollama Version (if applicable)
No response
Operating System
Windows 11
Browser (if applicable)
Firefox
Confirmation
README.md.Expected Behavior
Return chat answer
Actual Behavior
All queries end up with a "cannot access local variable 'model_id' where it is not associated with a value" error -- both local LLMs and API calls to OpenAI models. No obvious errors in console, and I have verified models work as expected using other clients.
Started happening after upgrade to 0.6.20.
Steps to Reproduce
Ask a query in new chat
Logs & Screenshots
Additional Information
No response
@aljaca commented on GitHub (Aug 10, 2025):
Same issue. Upgraded from 0.6.18 to 0.6.19 and then 0.6.20. Both 0.6.19 and 0.6.20 give "cannot access local variable 'model_id' where it is not associated with a value" error in any chat request.
OpenAI compatible API endpoint (llama-server) on Linux 6.14.0-27-generic #27~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 17:38:49 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
@geek0011 commented on GitHub (Aug 10, 2025):
would it be possible to downgrade to 0.6.18 now?
@aljaca commented on GitHub (Aug 10, 2025):
Yes, downgrading works for me.
@geek0011 commented on GitHub (Aug 10, 2025):
Can you tell me how to do that in docker? Thanks.
@aljaca commented on GitHub (Aug 10, 2025):
Sorry, no. Not a docker user -- pip install for me
@Lawlietr commented on GitHub (Aug 10, 2025):
Same issue here, all local models and openai api are not works.
@gaby commented on GitHub (Aug 10, 2025):
Can you run your instance in Debug mode, the logs should say what the error is:
--env GLOBAL_LOG_LEVEL="DEBUG"@gaby commented on GitHub (Aug 10, 2025):
These are the commits from the latest release that modify
model_id:bf3c807047f027df06d1@aljaca commented on GitHub (Aug 10, 2025):
2025-08-09 20:35:34.881 | DEBUG | open_webui.utils.middleware:process_chat_payload:737 - form_data: {'stream': True, 'model': 'Qwen3-30B-A3B-Instruct-2507', 'messages': [{'role': 'user', 'content': 'Tell me a random fun fact about the Roman Empire'}], 'features': {'image_generation': False, 'code_interpreter': False, 'web_search': False, 'memory': False}, 'variables': {'{{USER_NAME}}': 'USER', '{{USER_LOCATION}}': 'Unknown', '{{CURRENT_DATETIME}}': '2025-08-09 20:35:34', '{{CURRENT_DATE}}': '2025-08-09', '{{CURRENT_TIME}}': '20:35:34', '{{CURRENT_WEEKDAY}}': 'Saturday', '{{CURRENT_TIMEZONE}}': 'America/Vancouver', '{{USER_LANGUAGE}}': 'en-US'}, 'metadata': {'user_id': 'dbc785be-d488-425b-91d3-417abe9f4669', 'chat_id': '28566108-f41c-4a87-85a8-4dca57620a74', 'message_id': '9ad53493-70e1-4fca-99b4-1be34e375102', 'session_id': 'dVUUWW6b2gD_d5GqAAAB', 'filter_ids': [], 'tool_ids': None, 'tool_servers': [], 'files': None, 'features': {'image_generation': False, 'code_interpreter': False, 'web_search': False, 'memory': False}, 'variables': {'{{USER_NAME}}': 'USER', '{{USER_LOCATION}}': 'Unknown', '{{CURRENT_DATETIME}}': '2025-08-09 20:35:34', '{{CURRENT_DATE}}': '2025-08-09', '{{CURRENT_TIME}}': '20:35:34', '{{CURRENT_WEEKDAY}}': 'Saturday', '{{CURRENT_TIMEZONE}}': 'America/Vancouver', '{{USER_LANGUAGE}}': 'en-US'}, 'model': {'id': 'Qwen3-30B-A3B-Instruct-2507', 'object': 'model', 'created': 1754796922, 'owned_by': 'llamacpp', 'meta': {'vocab_type': 2, 'n_vocab': 151936, 'n_ctx_train': 262144, 'n_embd': 2048, 'n_params': 30532122624, 'size': 17684527104}, 'openai': {'id': 'Qwen3-30B-A3B-Instruct-2507'}, 'urlIdx': '0', 'tags': [], 'name': 'Qwen3-30B-A3B-Instruct-2507', 'direct': True}, 'direct': True, 'params': {'stream_delta_chunk_size': None, 'function_calling': 'default'}}} 2025-08-09 20:35:34.884 | DEBUG | open_webui.utils.middleware:process_chat_payload:905 - tool_ids=None 2025-08-09 20:35:34.884 | DEBUG | open_webui.utils.middleware:process_chat_payload:906 - tool_servers=[] 2025-08-09 20:35:34.884 | DEBUG | open_webui.utils.chat:generate_chat_completion:167 - generate_chat_completion: {'stream': True, 'model': 'Qwen3-30B-A3B-Instruct-2507', 'messages': [{'role': 'user', 'content': 'Tell me a random fun fact about the Roman Empire'}], 'metadata': {'user_id': 'dbc785be-d488-425b-91d3-417abe9f4669', 'chat_id': '28566108-f41c-4a87-85a8-4dca57620a74', 'message_id': '9ad53493-70e1-4fca-99b4-1be34e375102', 'session_id': 'dVUUWW6b2gD_d5GqAAAB', 'filter_ids': [], 'tool_ids': None, 'tool_servers': [], 'files': None, 'features': {'image_generation': False, 'code_interpreter': False, 'web_search': False, 'memory': False}, 'variables': {'{{USER_NAME}}': 'USER', '{{USER_LOCATION}}': 'Unknown', '{{CURRENT_DATETIME}}': '2025-08-09 20:35:34', '{{CURRENT_DATE}}': '2025-08-09', '{{CURRENT_TIME}}': '20:35:34', '{{CURRENT_WEEKDAY}}': 'Saturday', '{{CURRENT_TIMEZONE}}': 'America/Vancouver', '{{USER_LANGUAGE}}': 'en-US'}, 'model': {'id': 'Qwen3-30B-A3B-Instruct-2507', 'object': 'model', 'created': 1754796922, 'owned_by': 'llamacpp', 'meta': {'vocab_type': 2, 'n_vocab': 151936, 'n_ctx_train': 262144, 'n_embd': 2048, 'n_params': 30532122624, 'size': 17684527104}, 'openai': {'id': 'Qwen3-30B-A3B-Instruct-2507'}, 'urlIdx': '0', 'tags': [], 'name': 'Qwen3-30B-A3B-Instruct-2507', 'direct': True}, 'direct': True, 'params': {'stream_delta_chunk_size': None, 'function_calling': 'default'}}} 2025-08-09 20:35:34.884 | DEBUG | open_webui.utils.chat:generate_chat_completion:184 - direct connection to model: {'Qwen3-30B-A3B-Instruct-2507': {'id': 'Qwen3-30B-A3B-Instruct-2507', 'object': 'model', 'created': 1754796922, 'owned_by': 'llamacpp', 'meta': {'vocab_type': 2, 'n_vocab': 151936, 'n_ctx_train': 262144, 'n_embd': 2048, 'n_params': 30532122624, 'size': 17684527104}, 'openai': {'id': 'Qwen3-30B-A3B-Instruct-2507'}, 'urlIdx': '0', 'tags': [], 'name': 'Qwen3-30B-A3B-Instruct-2507', 'direct': True}} 2025-08-09 20:35:34.884 | INFO | open_webui.utils.chat:generate_direct_chat_completion:72 - generate_direct_chat_completion 2025-08-09 20:35:35.270 | INFO | open_webui.utils.chat:generate_direct_chat_completion:109 - res: {'status': True} 2025-08-09 20:35:35.270 | DEBUG | open_webui.main:chat_completion:1489 - Error in chat completion: cannot access local variable 'model_id' where it is not associated with a value@gaby commented on GitHub (Aug 10, 2025):
@aljaca Thanks, found the bug. I will submit a PR in a few minutes.
@gaby commented on GitHub (Aug 10, 2025):
@tjbck I'm not 100% sure if #16429 fixes the issue, but should help.
The code was moved in
bf3c807047by you.@devPermutations commented on GitHub (Aug 10, 2025):
Ubuntu server here running Docker. upgraded to 0.6.19 then 0.6.20 and the above error was occurring on any chat. It pulled the models correctly and validated that the connection to the api was correct (hence the models working). I went back to 0.6.19 and that did not resolve the issue. I went back to 0.6.18 for the issue to be resolved
@aljaca commented on GitHub (Aug 10, 2025):
Confirming that this fixes the issue for me on 0.6.20
@gaby commented on GitHub (Aug 10, 2025):
@aljaca Thanks for confirming! 💪
Ping @tjbck
@tjbck commented on GitHub (Aug 10, 2025):
Addressed in dev, 0.6.21 will be released shortly
@RomualdYT commented on GitHub (Feb 12, 2026):
@tjbck Problem is back on dev branch 0.8 :
`2026-02-12 11:38:07.547 | INFO | uvicorn.protocols.http.httptools_impl:send:483 - [REDACTED_IP]:[REDACTED_PORT] - "GET /api/v1/configs/connections HTTP/1.1" 200
2026-02-12 11:38:07.822 | ERROR | open_webui.routers.openai:get_models:630 - Unexpected error: External Error: {'message': 'Missing bearer authentication in header', 'type': 'invalid_request_error', 'param': None, 'code': None}
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 1485, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1406, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1269, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 824, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.11/site-packages/uvicorn/main.py", line 424, in main
run(
File "/usr/local/lib/python3.11/site-packages/uvicorn/main.py", line 594, in run
server.run()
File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 67, in run
return asyncio_run(self.serve(sockets=sockets), loop_factory=self.config.get_loop_factory())
File "/usr/local/lib/python3.11/site-packages/uvicorn/_compat.py", line 30, in asyncio_run
return runner.run(main)
File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
...
File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 314, in run_endpoint_function
return await dependant.call(**values)
User context:
UserModel(
id='[REDACTED_USER_ID]',
email='[REDACTED_EMAIL]',
username=None,
role='admin'
)
`
@Classic298 commented on GitHub (Feb 12, 2026):
ys pr here https://github.com/open-webui/open-webui/pull/21327