mirror of
https://github.com/open-webui/open-webui.git
synced 2026-03-10 07:43:10 -05:00
issue: try/except block accesses undeclared variables in chat_completion handler #4784
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 @lattwood on GitHub (Apr 9, 2025).
Check Existing Issues
Installation Method
Docker
Open WebUI Version
v0.6.2
Ollama Version (if applicable)
No response
Operating System
N/A
Browser (if applicable)
curl
Confirmation
README.md.Expected Behavior
When an exception is caught, the handler doesn't throw another uncaught exception.
Actual Behavior
If an exception is thrown in this block of code:
63533c9e3a/backend/open_webui/main.py (L1057-L1077)It will be caught by this:
63533c9e3a/backend/open_webui/main.py (L1109-L1117)But,
metadataisn't defined as a local variable until Line 1078.Steps to Reproduce
When I ran into this, it was while trying to directly upload a file via the API to the model to attempt to bypass any of the OCR/PyPDF handling that's done.
Logs & Screenshots
Additional Information
No response
@lattwood commented on GitHub (Apr 9, 2025):
This is a duplicate of #12658
@tjbck commented on GitHub (Apr 9, 2025):
Addressed in dev.