mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-10 04:20:44 +02:00
fix: don't crash on startup when stdout can't encode the banner (#25482)
The startup banner uses Unicode box-drawing characters. On a stdout that can't encode them (Windows cp1252, or redirected/headless/pythonw output) print() raises UnicodeEncodeError and aborts startup. This blocks running open-webui serve headless on Windows. Guard the banner print and fall back to a plain ASCII line so startup always proceeds regardless of the console encoding. Fixes #24965 Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -608,7 +608,7 @@ class SPAStaticFiles(StaticFiles):
|
||||
|
||||
|
||||
if LOG_FORMAT != 'json':
|
||||
print(rf"""
|
||||
banner = rf"""
|
||||
██████╗ ██████╗ ███████╗███╗ ██╗ ██╗ ██╗███████╗██████╗ ██╗ ██╗██╗
|
||||
██╔═══██╗██╔══██╗██╔════╝████╗ ██║ ██║ ██║██╔════╝██╔══██╗██║ ██║██║
|
||||
██║ ██║██████╔╝█████╗ ██╔██╗ ██║ ██║ █╗ ██║█████╗ ██████╔╝██║ ██║██║
|
||||
@@ -620,7 +620,12 @@ if LOG_FORMAT != 'json':
|
||||
v{VERSION} - building the best AI user interface.
|
||||
{f'Commit: {WEBUI_BUILD_HASH}' if WEBUI_BUILD_HASH != 'dev-build' else ''}
|
||||
https://github.com/open-webui/open-webui
|
||||
""")
|
||||
"""
|
||||
try:
|
||||
print(banner)
|
||||
except UnicodeEncodeError:
|
||||
# Stdout can't encode the box-drawing banner (Windows cp1252, redirected/headless stdout); fall back to ASCII.
|
||||
print(f'Open WebUI v{VERSION} - building the best AI user interface.\nhttps://github.com/open-webui/open-webui')
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
|
||||
Reference in New Issue
Block a user