mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 11:28:35 -05:00
[GH-ISSUE #24234] issue: Windows PostgreSQL startup fails with psycopg ProactorEventLoop error #58901
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 @ppoak on GitHub (Apr 29, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/24234
Bug Report
Check Existing Issues
I found an older related Windows event loop discussion for
aiodns/WindowsSelectorEventLoopPolicy(#10813), but I did not find a matching report for the current Open WebUI v0.9.x PostgreSQL runtime path using psycopg v3 async connections.Installation Method
Pip Install / uvx
Open WebUI Version
v0.9.2
Ollama Version (if applicable)
Not applicable.
Operating System
Windows 11 Pro for Workstations, 64-bit
Browser (if applicable)
Not applicable. The backend fails during application startup before the web UI is available.
Confirmation
README.md.open-webui@latestat the time of testing.Expected Behavior
Open WebUI should start successfully on Windows when configured with a PostgreSQL
DATABASE_URL.At minimum, the Windows startup path should use an event loop compatible with
psycopgv3 async connections, or Open WebUI should document/handle the required Windows selector event loop configuration when PostgreSQL is used.Actual Behavior
Open WebUI v0.9.2 fails during FastAPI lifespan startup when
DATABASE_URLpoints to PostgreSQL.The sync migration path succeeds, but the runtime async SQLAlchemy engine uses
postgresql+psycopg://.... On Windows, uvicorn 0.41.0 creates aProactorEventLoopfor the server process, and psycopg v3 async connections reject that loop:Adding
--with psycopg2does not avoid the failure because Open WebUI converts PostgreSQL runtime URLs topostgresql+psycopg://...inopen_webui/internal/db.py, so runtime async DB access still uses psycopg v3.Steps to Reproduce
On Windows 11, configure Open WebUI with a PostgreSQL database:
Start Open WebUI through uvx with Python 3.11:
Wait for startup to reach application lifespan initialization.
Observe that startup exits with
Application startup failedand the psycopgProactorEventLooperror.Logs & Screenshots
Environment details from the failing setup:
Relevant startup log:
I also confirmed that PostgreSQL itself is reachable on
localhost:5432; the failure is not a connection refused/authentication problem.Additional Information
I tested a local workaround by monkey-patching uvicorn's asyncio loop factory before importing Open WebUI:
Starting Open WebUI through this wrapper succeeds, and
GET http://127.0.0.1:8080/healthreturns:This suggests the immediate issue is that the Open WebUI + uvicorn startup path on Windows uses
ProactorEventLoop, while the v0.9.x PostgreSQL async runtime path now requires a selector-compatible loop for psycopg v3.Possible fixes could include one of the following:
@rgaricano commented on GitHub (Apr 29, 2026):
it's reported, workaround: https://github.com/open-webui/open-webui/issues/24152#issuecomment-4336307770