I have searched the existing issues and discussions.
I am using the latest version of Open WebUI.
Installation Method
Docker
Open WebUI Version
0.6.4
Ollama Version (if applicable)
No response
Operating System
Ubuntu 24.04.2 LTS
Browser (if applicable)
No response
Confirmation
I have read and followed all instructions in README.md.
I am using the latest version of both Open WebUI and Ollama.
I have included the browser console logs.
I have included the Docker container logs.
I have provided every relevant configuration, setting, and environment variable used in my setup.
I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
Start with the initial platform/version/OS and dependencies used,
Specify exact install/launch/configure commands,
List URLs visited, user input (incl. example values/emails/passwords if needed),
Describe all options and toggles enabled or changed,
Include any files or environmental changes,
Identify the expected and actual result at each stage,
Ensure any reasonably skilled user can follow and hit the same issue.
Expected Behavior
Open WebUI should connect to the PostgreSQL database and start normally.
Actual Behavior
When running Open WebUI (tested with v0.6.4 and latest) in Docker Compose with a valid PostgreSQL backend, the container fails to start due to a Python exception:
UnboundLocalError: cannot access local variable 'db' where it is not associated with a value
This occurs in /app/backend/open_webui/internal/db.py during the handle_peewee_migration(DATABASE_URL) call.
Note: The application starts and works as expected when using the default (SQLite) backend (i.e., when DATABASE_URL is not set). The error only occurs when attempting to use PostgreSQL by setting DATABASE_URL.
Environment
Open WebUI image: ghcr.io/open-webui/open-webui:v0.6.4 (also fails with latest)
Docker Compose version: 1.29.2
PostgreSQL image: postgres:15-alpine
Host OS: Ubuntu 24.04.2 LTS (EC2)
Relevant docker-compose.yml excerpt:
open-webui:image:ghcr.io/open-webui/open-webui:v0.6.4container_name:ai-ui-open-webuienvironment:- DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}# ... other env vars ...depends_on:postgres:condition:service_healthyredis:condition:service_healthylitellm:condition:service_healthy# ... rest omitted ...
Steps to Reproduce
Deploy Open WebUI with the above docker-compose config and a healthy Postgres backend.
Start the container: docker-compose up -d open-webui
Observe the container fails with the above Python error.
Logs & Screenshots
File "/app/backend/open_webui/internal/db.py", line 75, in <module>
handle_peewee_migration(DATABASE_URL)
File "/app/backend/open_webui/internal/db.py", line 68, in handle_peewee_migration
if db and not db.is_closed():
UnboundLocalError: cannot access local variable 'db' where it is not associated with a value
Additional Information
The same error occurs specifically with PostgreSQL backend.
All other services (Postgres, Redis, LiteLLM) are healthy.
Removing/recreating containers and volumes does not resolve the issue.
This appears to be a regression in recent Open WebUI images.
Again, the application works as expected with the default SQLite backend, but fails with PostgreSQL.
Originally created by @manooll on GitHub (Jun 12, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/14942
Originally assigned to: @jackthgu on GitHub.
### Check Existing Issues
- [x] I have searched the existing issues and discussions.
- [x] I am using the latest version of Open WebUI.
### Installation Method
Docker
### Open WebUI Version
0.6.4
### Ollama Version (if applicable)
_No response_
### Operating System
Ubuntu 24.04.2 LTS
### Browser (if applicable)
_No response_
### Confirmation
- [x] I have read and followed all instructions in `README.md`.
- [x] I am using the latest version of **both** Open WebUI and Ollama.
- [x] I have included the browser console logs.
- [x] I have included the Docker container logs.
- [x] I have **provided every relevant configuration, setting, and environment variable used in my setup.**
- [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
- [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps:
- Start with the initial platform/version/OS and dependencies used,
- Specify exact install/launch/configure commands,
- List URLs visited, user input (incl. example values/emails/passwords if needed),
- Describe all options and toggles enabled or changed,
- Include any files or environmental changes,
- Identify the expected and actual result at each stage,
- Ensure any reasonably skilled user can follow and hit the same issue.
### Expected Behavior
Open WebUI should connect to the PostgreSQL database and start normally.
### Actual Behavior
When running Open WebUI (tested with v0.6.4 and latest) in Docker Compose with a valid PostgreSQL backend, the container fails to start due to a Python exception:
```
UnboundLocalError: cannot access local variable 'db' where it is not associated with a value
```
This occurs in `/app/backend/open_webui/internal/db.py` during the `handle_peewee_migration(DATABASE_URL)` call.
**Note:** The application starts and works as expected when using the default (SQLite) backend (i.e., when `DATABASE_URL` is not set). The error only occurs when attempting to use PostgreSQL by setting `DATABASE_URL`.
---
## Environment
- **Open WebUI image:** ghcr.io/open-webui/open-webui:v0.6.4 (also fails with latest)
- **Docker Compose version:** 1.29.2
- **PostgreSQL image:** postgres:15-alpine
- **Host OS:** Ubuntu 24.04.2 LTS (EC2)
- **Relevant docker-compose.yml excerpt:**
```yaml
open-webui:
image: ghcr.io/open-webui/open-webui:v0.6.4
container_name: ai-ui-open-webui
environment:
- DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
# ... other env vars ...
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
litellm:
condition: service_healthy
# ... rest omitted ...
```
### Steps to Reproduce
1. Deploy Open WebUI with the above docker-compose config and a healthy Postgres backend.
2. Start the container: `docker-compose up -d open-webui`
3. Observe the container fails with the above Python error.
### Logs & Screenshots
```
File "/app/backend/open_webui/internal/db.py", line 75, in <module>
handle_peewee_migration(DATABASE_URL)
File "/app/backend/open_webui/internal/db.py", line 68, in handle_peewee_migration
if db and not db.is_closed():
UnboundLocalError: cannot access local variable 'db' where it is not associated with a value
```
### Additional Information
- The same error occurs specifically with PostgreSQL backend.
- All other services (Postgres, Redis, LiteLLM) are healthy.
- Removing/recreating containers and volumes does not resolve the issue.
- This appears to be a regression in recent Open WebUI images.
- **Again, the application works as expected with the default SQLite backend, but fails with PostgreSQL.**
GiteaMirror
added the bug label 2026-05-13 03:59:08 -05:00
do you have vectordb in postgresql too?
The error is, probably, because PGVECTOR_DB_URL env var isn't setted
<!-- gh-comment-id:2968659307 -->
@rgaricano commented on GitHub (Jun 13, 2025):
do you have vectordb in postgresql too?
The error is, probably, because PGVECTOR_DB_URL env var isn't setted
I had the same problem. Here is a complete log.
I noticed there was an initialization error before this error, is it because I missed some configuration?
I have set DATABASE_URL, DATABASE_SCHEMA, VECTOR_DB=pgvector, PGVECTOR_DB_URL=${DATABASE_URL}
open-webui | Loading WEBUI_SECRET_KEY from file, not provided as an environment variable.
open-webui | Generating WEBUI_SECRET_KEY
open-webui | Loading WEBUI_SECRET_KEY from .webui_secret_key
open-webui | Failed to initialize the database connection: Error, database must be initialized before opening a connection.
open-webui | Traceback (most recent call last):
open-webui | File "/app/backend/open_webui/internal/db.py", line 57, in handle_peewee_migration
open-webui | db = register_connection(DATABASE_URL.replace("postgresql://", "postgres://"))
open-webui | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
open-webui | File "/app/backend/open_webui/internal/wrappers.py", line 58, in register_connection
open-webui | db.connect(reuse_if_open=True)
open-webui | File "/usr/local/lib/python3.11/site-packages/peewee.py", line 3254, in connect
open-webui | raise InterfaceError('Error, database must be initialized '
open-webui | peewee.InterfaceError: Error, database must be initialized before opening a connection.
open-webui |
open-webui | During handling of the above exception, another exception occurred:
open-webui |
open-webui | Traceback (most recent call last):
open-webui | File "<frozen runpy>", line 198, in _run_module_as_main
open-webui | File "<frozen runpy>", line 88, in _run_code
open-webui | File "/usr/local/lib/python3.11/site-packages/uvicorn/__main__.py", line 4, in <module>
open-webui | uvicorn.main()
open-webui | File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1442, in __call__
open-webui | return self.main(*args, **kwargs)
open-webui | ^^^^^^^^^^^^^^^^^^^^^^^^^^
open-webui | File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1363, in main
open-webui | rv = self.invoke(ctx)
open-webui | ^^^^^^^^^^^^^^^^
open-webui | File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1226, in invoke
open-webui | return ctx.invoke(self.callback, **ctx.params)
open-webui | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
open-webui | File "/usr/local/lib/python3.11/site-packages/click/core.py", line 794, in invoke
open-webui | return callback(*args, **kwargs)
open-webui | ^^^^^^^^^^^^^^^^^^^^^^^^^
open-webui | File "/usr/local/lib/python3.11/site-packages/uvicorn/main.py", line 413, in main
open-webui | run(
open-webui | File "/usr/local/lib/python3.11/site-packages/uvicorn/main.py", line 580, in run
open-webui | server.run()
open-webui | File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 66, in run
open-webui | return asyncio.run(self.serve(sockets=sockets))
open-webui | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
open-webui | File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
open-webui | return runner.run(main)
open-webui | ^^^^^^^^^^^^^^^^
open-webui | File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
open-webui | return self._loop.run_until_complete(task)
open-webui | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
open-webui | File "uvloop/loop.pyx", line 1518, in uvloop.loop.Loop.run_until_complete
open-webui | File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 70, in serve
open-webui | await self._serve(sockets)
open-webui | File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 77, in _serve
open-webui | config.load()
open-webui | File "/usr/local/lib/python3.11/site-packages/uvicorn/config.py", line 435, in load
open-webui | self.loaded_app = import_from_string(self.app)
open-webui | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
open-webui | File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 19, in import_from_string
open-webui | module = importlib.import_module(module_str)
open-webui | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
open-webui | File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
open-webui | return _bootstrap._gcd_import(name[level:], package, level)
open-webui | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
open-webui | File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
open-webui | File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
open-webui | File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
open-webui | File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
open-webui | File "<frozen importlib._bootstrap_external>", line 940, in exec_module
open-webui | File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
open-webui | File "/app/backend/open_webui/main.py", line 55, in <module>
open-webui | from open_webui.utils.audit import AuditLevel, AuditLoggingMiddleware
open-webui | File "/app/backend/open_webui/utils/audit.py", line 28, in <module>
open-webui | from open_webui.utils.auth import get_current_user, get_http_authorization_cred
open-webui | File "/app/backend/open_webui/utils/auth.py", line 18, in <module>
open-webui | from open_webui.models.users import Users
open-webui | File "/app/backend/open_webui/models/users.py", line 4, in <module>
open-webui | from open_webui.internal.db import Base, JSONField, get_db
open-webui | File "/app/backend/open_webui/internal/db.py", line 75, in <module>
open-webui | handle_peewee_migration(DATABASE_URL)
open-webui | File "/app/backend/open_webui/internal/db.py", line 68, in handle_peewee_migration
open-webui | if db and not db.is_closed():
open-webui | ^^
open-webui | UnboundLocalError: cannot access local variable 'db' where it is not associated with a value
open-webui | /app/backend/open_webui
open-webui | /app/backend
open-webui | /app
<!-- gh-comment-id:2969413479 -->
@hr567 commented on GitHub (Jun 13, 2025):
I had the same problem. Here is a complete log.
I noticed there was an initialization error before this error, is it because I missed some configuration?
I have set DATABASE_URL, DATABASE_SCHEMA, VECTOR_DB=pgvector, PGVECTOR_DB_URL=${DATABASE_URL}
```
open-webui | Loading WEBUI_SECRET_KEY from file, not provided as an environment variable.
open-webui | Generating WEBUI_SECRET_KEY
open-webui | Loading WEBUI_SECRET_KEY from .webui_secret_key
open-webui | Failed to initialize the database connection: Error, database must be initialized before opening a connection.
open-webui | Traceback (most recent call last):
open-webui | File "/app/backend/open_webui/internal/db.py", line 57, in handle_peewee_migration
open-webui | db = register_connection(DATABASE_URL.replace("postgresql://", "postgres://"))
open-webui | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
open-webui | File "/app/backend/open_webui/internal/wrappers.py", line 58, in register_connection
open-webui | db.connect(reuse_if_open=True)
open-webui | File "/usr/local/lib/python3.11/site-packages/peewee.py", line 3254, in connect
open-webui | raise InterfaceError('Error, database must be initialized '
open-webui | peewee.InterfaceError: Error, database must be initialized before opening a connection.
open-webui |
open-webui | During handling of the above exception, another exception occurred:
open-webui |
open-webui | Traceback (most recent call last):
open-webui | File "<frozen runpy>", line 198, in _run_module_as_main
open-webui | File "<frozen runpy>", line 88, in _run_code
open-webui | File "/usr/local/lib/python3.11/site-packages/uvicorn/__main__.py", line 4, in <module>
open-webui | uvicorn.main()
open-webui | File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1442, in __call__
open-webui | return self.main(*args, **kwargs)
open-webui | ^^^^^^^^^^^^^^^^^^^^^^^^^^
open-webui | File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1363, in main
open-webui | rv = self.invoke(ctx)
open-webui | ^^^^^^^^^^^^^^^^
open-webui | File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1226, in invoke
open-webui | return ctx.invoke(self.callback, **ctx.params)
open-webui | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
open-webui | File "/usr/local/lib/python3.11/site-packages/click/core.py", line 794, in invoke
open-webui | return callback(*args, **kwargs)
open-webui | ^^^^^^^^^^^^^^^^^^^^^^^^^
open-webui | File "/usr/local/lib/python3.11/site-packages/uvicorn/main.py", line 413, in main
open-webui | run(
open-webui | File "/usr/local/lib/python3.11/site-packages/uvicorn/main.py", line 580, in run
open-webui | server.run()
open-webui | File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 66, in run
open-webui | return asyncio.run(self.serve(sockets=sockets))
open-webui | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
open-webui | File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
open-webui | return runner.run(main)
open-webui | ^^^^^^^^^^^^^^^^
open-webui | File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
open-webui | return self._loop.run_until_complete(task)
open-webui | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
open-webui | File "uvloop/loop.pyx", line 1518, in uvloop.loop.Loop.run_until_complete
open-webui | File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 70, in serve
open-webui | await self._serve(sockets)
open-webui | File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 77, in _serve
open-webui | config.load()
open-webui | File "/usr/local/lib/python3.11/site-packages/uvicorn/config.py", line 435, in load
open-webui | self.loaded_app = import_from_string(self.app)
open-webui | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
open-webui | File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 19, in import_from_string
open-webui | module = importlib.import_module(module_str)
open-webui | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
open-webui | File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
open-webui | return _bootstrap._gcd_import(name[level:], package, level)
open-webui | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
open-webui | File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
open-webui | File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
open-webui | File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
open-webui | File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
open-webui | File "<frozen importlib._bootstrap_external>", line 940, in exec_module
open-webui | File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
open-webui | File "/app/backend/open_webui/main.py", line 55, in <module>
open-webui | from open_webui.utils.audit import AuditLevel, AuditLoggingMiddleware
open-webui | File "/app/backend/open_webui/utils/audit.py", line 28, in <module>
open-webui | from open_webui.utils.auth import get_current_user, get_http_authorization_cred
open-webui | File "/app/backend/open_webui/utils/auth.py", line 18, in <module>
open-webui | from open_webui.models.users import Users
open-webui | File "/app/backend/open_webui/models/users.py", line 4, in <module>
open-webui | from open_webui.internal.db import Base, JSONField, get_db
open-webui | File "/app/backend/open_webui/internal/db.py", line 75, in <module>
open-webui | handle_peewee_migration(DATABASE_URL)
open-webui | File "/app/backend/open_webui/internal/db.py", line 68, in handle_peewee_migration
open-webui | if db and not db.is_closed():
open-webui | ^^
open-webui | UnboundLocalError: cannot access local variable 'db' where it is not associated with a value
open-webui | /app/backend/open_webui
open-webui | /app/backend
open-webui | /app
```
Yes, it appears on a newly created instance via ghcr.io/open-webui/open-webui:main (0bf4d267253b).
<!-- gh-comment-id:2969643807 -->
@hr567 commented on GitHub (Jun 13, 2025):
> Does this occur with the latest main as well?
Yes, it appears on a newly created instance via ghcr.io/open-webui/open-webui:main (0bf4d267253b).
The special characters in POSTGRES_USER or POSTGRES_PASSWORD might have caused this issue, and I was able to connect after testing with a simple username and password.
<!-- gh-comment-id:2969863283 -->
@hr567 commented on GitHub (Jun 13, 2025):
The special characters in POSTGRES_USER or POSTGRES_PASSWORD might have caused this issue, and I was able to connect after testing with a simple username and password.
I had the same problem. Here is a complete log. I noticed there was an initialization error before this error, is it because I missed some configuration? I have set DATABASE_URL, DATABASE_SCHEMA, VECTOR_DB=pgvector, PGVECTOR_DB_URL=${DATABASE_URL}
DATABASE_URL & PGVECTOR_DB_URL have to be 2 different databases, (on postgresql vectordb have to be a database with vector extension enabled)
<!-- gh-comment-id:2970189815 -->
@rgaricano commented on GitHub (Jun 13, 2025):
> I had the same problem. Here is a complete log. I noticed there was an initialization error before this error, is it because I missed some configuration? I have set DATABASE_URL, DATABASE_SCHEMA, VECTOR_DB=pgvector, PGVECTOR_DB_URL=${DATABASE_URL}
>
DATABASE_URL & PGVECTOR_DB_URL have to be 2 different databases, (on postgresql vectordb have to be a database with vector extension enabled)
Hello, if possible, could you please include more detailed logs when the error occurs? It would be very helpful if you could include a bit more log content leading up to the point where the error occurs.
<!-- gh-comment-id:2984962190 -->
@jackthgu commented on GitHub (Jun 18, 2025):
Hello, if possible, could you please include more detailed logs when the error occurs? It would be very helpful if you could include a bit more log content leading up to the point where the error occurs.
Hello, if possible, could you please include more detailed logs when the error occurs? It would be very helpful if you could include a bit more log content leading up to the point where the error occurs.
Thanks for your support.
In my use case, the problem is caused by special characters in complex passwords. I tried to reproduce this issue with an invalid DATABASE_URL, such as a password of abc@123. The presence of an @ causes issues with URL parsing. This leads to the error seen in the log I uploaded. I'm not sure how to set such special passwords in a URL. However, adding some checks or logs here might make the error clearer. The original error is misleading, making it difficult to determine the real cause of the error. I'm not sure if the issue's author encountered the same problem.
<!-- gh-comment-id:2986502808 -->
@hr567 commented on GitHub (Jun 19, 2025):
> Hello, if possible, could you please include more detailed logs when the error occurs? It would be very helpful if you could include a bit more log content leading up to the point where the error occurs.
Thanks for your support.
In my use case, the problem is caused by special characters in complex passwords. I tried to reproduce this issue with an invalid DATABASE_URL, such as a password of abc@123. The presence of an @ causes issues with URL parsing. This leads to the error seen in the log I uploaded. I'm not sure how to set such special passwords in a URL. However, adding some checks or logs here might make the error clearer. The original error is misleading, making it difficult to determine the real cause of the error. I'm not sure if the issue's author encountered the same problem.
@manooll Have the issues been resolved based on our previous discussions?
<!-- gh-comment-id:3004091528 -->
@jackthgu commented on GitHub (Jun 25, 2025):
@manooll Have the issues been resolved based on our previous discussions?
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @manooll on GitHub (Jun 12, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/14942
Originally assigned to: @jackthgu on GitHub.
Check Existing Issues
Installation Method
Docker
Open WebUI Version
0.6.4
Ollama Version (if applicable)
No response
Operating System
Ubuntu 24.04.2 LTS
Browser (if applicable)
No response
Confirmation
README.md.Expected Behavior
Open WebUI should connect to the PostgreSQL database and start normally.
Actual Behavior
When running Open WebUI (tested with v0.6.4 and latest) in Docker Compose with a valid PostgreSQL backend, the container fails to start due to a Python exception:
This occurs in
/app/backend/open_webui/internal/db.pyduring thehandle_peewee_migration(DATABASE_URL)call.Note: The application starts and works as expected when using the default (SQLite) backend (i.e., when
DATABASE_URLis not set). The error only occurs when attempting to use PostgreSQL by settingDATABASE_URL.Environment
Steps to Reproduce
docker-compose up -d open-webuiLogs & Screenshots
Additional Information
@rgaricano commented on GitHub (Jun 13, 2025):
do you have vectordb in postgresql too?
The error is, probably, because PGVECTOR_DB_URL env var isn't setted
@hr567 commented on GitHub (Jun 13, 2025):
I had the same problem. Here is a complete log.
I noticed there was an initialization error before this error, is it because I missed some configuration?
I have set DATABASE_URL, DATABASE_SCHEMA, VECTOR_DB=pgvector, PGVECTOR_DB_URL=${DATABASE_URL}
@tjbck commented on GitHub (Jun 13, 2025):
Does this occur with the latest main as well?
@hr567 commented on GitHub (Jun 13, 2025):
Yes, it appears on a newly created instance via ghcr.io/open-webui/open-webui:main (0bf4d267253b).
@hr567 commented on GitHub (Jun 13, 2025):
The special characters in POSTGRES_USER or POSTGRES_PASSWORD might have caused this issue, and I was able to connect after testing with a simple username and password.
@rgaricano commented on GitHub (Jun 13, 2025):
DATABASE_URL & PGVECTOR_DB_URL have to be 2 different databases, (on postgresql vectordb have to be a database with vector extension enabled)
@jackthgu commented on GitHub (Jun 18, 2025):
Hello, if possible, could you please include more detailed logs when the error occurs? It would be very helpful if you could include a bit more log content leading up to the point where the error occurs.
@hr567 commented on GitHub (Jun 19, 2025):
Thanks for your support.
In my use case, the problem is caused by special characters in complex passwords. I tried to reproduce this issue with an invalid DATABASE_URL, such as a password of abc@123. The presence of an @ causes issues with URL parsing. This leads to the error seen in the log I uploaded. I'm not sure how to set such special passwords in a URL. However, adding some checks or logs here might make the error clearer. The original error is misleading, making it difficult to determine the real cause of the error. I'm not sure if the issue's author encountered the same problem.
@jackthgu commented on GitHub (Jun 25, 2025):
@manooll Have the issues been resolved based on our previous discussions?