[PR #14137] [CLOSED] chore: Improve the exception details in logging for easier troubleshooting #110707

Closed
opened 2026-05-18 10:21:21 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/14137
Author: @jairov4
Created: 5/21/2025
Status: ❌ Closed

Base: dev ← Head: main


📝 Commits (1)

  • a4f2588 feat: Improve the exception details in logging for easier troubleshooting

📊 Changes

1 file changed (+7 additions, -10 deletions)

View changed files

📝 backend/open_webui/main.py (+7 -10)

📄 Description

Fixed

When you are testing tools, filters, etc you often dont know why your python code failed.
Looking at the log you only see the result of str(e) which provides vague details.
For example you can see just type as the error message with no additional context.
In this change the Exception details will be logged following the standard configuration through the logging facilities.
Typically it will also include stack trace which will help a lot in understanding the error cause.

For example:

2025-05-21 12:00:20.942 | DEBUG    | open_webui.main:chat_completion:1217 - Error processing chat payload: 'type' - {}
2025-05-21 12:00:20.961 | INFO     | uvicorn.protocols.http.httptools_impl:send:476 - 186.168.123.58:0 - "POST /api/chat/completions HTTP/1.1" 400 - {}

After this change you will be able to see:

2025-05-21 12:26:20.919 | ERROR    | open_webui.main:chat_completion:1217 - Error processing chat payload - {}
...
Traceback (most recent call last):
  File "/app/backend/open_webui/utils/tools.py", line 163, in get_tools
    if val["type"] == "str":
       └ {'anyOf': [{'type': 'string'}, {'type': 'null'}], 'default': None, 'description': 'The documentTypeName the user is looking f...

KeyError: 'type'
2025-05-21 12:26:20.947 | INFO     | uvicorn.protocols.http.httptools_impl:send:476 - 186.168.123.58:0 - "POST /api/chat/completions HTTP/1.1" 400 - {}

which guide you to figure out the real cause: there is an optional parameter whcih causes the json schema uses the anyOf entry. Then it produces a KeyError exception!!!


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/14137 **Author:** [@jairov4](https://github.com/jairov4) **Created:** 5/21/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `main` --- ### 📝 Commits (1) - [`a4f2588`](https://github.com/open-webui/open-webui/commit/a4f25888aaf5ffc2bdac53b9c77bb80cd7b2b5fd) feat: Improve the exception details in logging for easier troubleshooting ### 📊 Changes **1 file changed** (+7 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/main.py` (+7 -10) </details> ### 📄 Description ### Fixed When you are testing tools, filters, etc you often dont know why your python code failed. Looking at the log you only see the result of `str(e)` which provides vague details. For example you can see just `type` as the error message with no additional context. In this change the Exception details will be logged following the standard configuration through the logging facilities. Typically it will also include stack trace which will help a lot in understanding the error cause. For example: ``` 2025-05-21 12:00:20.942 | DEBUG | open_webui.main:chat_completion:1217 - Error processing chat payload: 'type' - {} 2025-05-21 12:00:20.961 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 186.168.123.58:0 - "POST /api/chat/completions HTTP/1.1" 400 - {} ``` After this change you will be able to see: ``` 2025-05-21 12:26:20.919 | ERROR | open_webui.main:chat_completion:1217 - Error processing chat payload - {} ... Traceback (most recent call last): File "/app/backend/open_webui/utils/tools.py", line 163, in get_tools if val["type"] == "str": └ {'anyOf': [{'type': 'string'}, {'type': 'null'}], 'default': None, 'description': 'The documentTypeName the user is looking f... KeyError: 'type' 2025-05-21 12:26:20.947 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 186.168.123.58:0 - "POST /api/chat/completions HTTP/1.1" 400 - {} ``` which guide you to figure out the real cause: there is an optional parameter whcih causes the json schema uses the anyOf entry. Then it produces a KeyError exception!!! --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-18 10:21:21 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#110707