mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 14:39:31 -05:00
[GH-ISSUE #21422] issue: Database Migration Error #90216
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 @bran1210 on GitHub (Feb 14, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/21422
Check Existing Issues
Installation Method
Docker
Open WebUI Version
v0.8.1
Ollama Version (if applicable)
v0.16.1
Operating System
Windows 11
Browser (if applicable)
No response
Confirmation
README.md.Expected Behavior
SQLite database upgrade from v0.7.2 to v.0.8.1.
Actual Behavior
Filed to migrate database, closing the containing after each start attempt.
Steps to Reproduce
Logs & Screenshots
root@684d040bf15d:/app/backend/open_webui# alembic current -v
INFO [alembic.runtime.migration] Context impl SQLiteImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
Current revision(s) for sqlite:////app/backend/data/webui.db:
Rev: 374d2f66af06
Parent: c440947495f3
Path: /app/backend/open_webui/migrations/versions/374d2f66af06_add_prompt_history_table.py
root@684d040bf15d:/app/backend/open_webui# alembic heads
-> 7e5b5dc7342b, init root@684d040bf15d:/app/backend/open_webui# alembic upgrade head --sql | head -30 INFO [alembic.runtime.migration] Context impl SQLiteImpl. INFO [alembic.runtime.migration] Generating static SQL INFO [alembic.runtime.migration] Will assume non-transactional DDL. CREATE TABLE alembic_version ( version_num VARCHAR(32) NOT NULL, CONSTRAINT alembic_version_pkc PRIMARY KEY (version_num) );b2c3d4e5f6a7 (head)
root@684d040bf15d:/app/backend/open_webui# alembic history
a1b2c3d4e5f6 -> b2c3d4e5f6a7 (head), add scim column to user table
f1e2d3c4b5a6 -> a1b2c3d4e5f6, Add skill table
8452d01d26d7 -> f1e2d3c4b5a6, Add access_grant table
374d2f66af06 -> 8452d01d26d7, Add chat_message table
c440947495f3 -> 374d2f66af06, Add prompt history table
81cc2ce44d79 -> c440947495f3, Add chat_file table
6283dc0e4d8d -> 81cc2ce44d79, Update channel file and knowledge table
3e0e00844bb0 -> 6283dc0e4d8d, Add channel file table
90ef40d4714e -> 3e0e00844bb0, Add knowledge_file table
b10670c03dd5 -> 90ef40d4714e, Update channel and channel members table
2f1211949ecc -> b10670c03dd5, Update user table
37f288994c47 -> 2f1211949ecc, Update messages and channel member table
a5c220713937 -> 37f288994c47, add_group_member_table
38d63c18f30f -> a5c220713937, Add reply_to_id column to message
3af16a1c9fb6 -> 38d63c18f30f, Add oauth_session table
018012973d35 -> 3af16a1c9fb6, update user table
d31026856c01 -> 018012973d35, Add indexes
9f0c9cd09105 -> d31026856c01, Update folder table data
3781e22d8b01 -> 9f0c9cd09105, Add note table
7826ab40b532 -> 3781e22d8b01, Update message & channel tables
57c599a3cb57 -> 7826ab40b532, Update file table
922e7a387820 -> 57c599a3cb57, Add channel table
4ace53fd72c8 -> 922e7a387820, Add group table
af906e964978 -> 4ace53fd72c8, Update folder table and change DateTime to BigInteger for timestamp fields
c29facfe716b -> af906e964978, Add feedback table
c69f45358db4 -> c29facfe716b, Update file table path
3ab32c4b8f59 -> c69f45358db4, Add folder table
1af9b942657b -> 3ab32c4b8f59, Update tags
242a2047eae0 -> 1af9b942657b, Migrate tags
6a39f3d8e55c -> 242a2047eae0, Update chat table
c0fbf31ca0db -> 6a39f3d8e55c, Add knowledge table
ca81bd47c050 -> c0fbf31ca0db, Update file table
7e5b5dc7342b -> ca81bd47c050, Add config table
INFO [alembic.runtime.migration] Running upgrade -> 7e5b5dc7342b, init
-- Running upgrade -> 7e5b5dc7342b
Traceback (most recent call last):
File "/usr/local/bin/alembic", line 10, in
sys.exit(main())
^^^^^^
File "/usr/local/lib/python3.11/site-packages/alembic/config.py", line 1047, in main
CommandLine(prog=prog).main(argv=argv)
File "/usr/local/lib/python3.11/site-packages/alembic/config.py", line 1037, in main
self.run_cmd(cfg, options)
File "/usr/local/lib/python3.11/site-packages/alembic/config.py", line 971, in run_cmd
fn(
File "/usr/local/lib/python3.11/site-packages/alembic/command.py", line 483, in upgrade
script.run_env()
File "/usr/local/lib/python3.11/site-packages/alembic/script/base.py", line 545, in run_env
util.load_python_file(self.dir, "env.py")
File "/usr/local/lib/python3.11/site-packages/alembic/util/pyfiles.py", line 116, in load_python_file
module = load_module_py(module_id, path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/alembic/util/pyfiles.py", line 136, in load_module_py
spec.loader.exec_module(module) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "/app/backend/open_webui/migrations/env.py", line 106, in
run_migrations_offline()
File "/app/backend/open_webui/migrations/env.py", line 55, in run_migrations_offline
context.run_migrations()
File "", line 8, in run_migrations
File "/usr/local/lib/python3.11/site-packages/alembic/runtime/environment.py", line 969, in run_migrations
self.get_context().run_migrations(**kw)
File "/usr/local/lib/python3.11/site-packages/alembic/runtime/migration.py", line 626, in run_migrations
step.migration_fn(**kw)
File "/app/backend/open_webui/migrations/versions/7e5b5dc7342b_init.py", line 26, in upgrade
existing_tables = set(get_existing_tables())
^^^^^^^^^^^^^^^^^^^^^
File "/app/backend/open_webui/../open_webui/migrations/util.py", line 7, in get_existing_tables
inspector = Inspector.from_engine(con)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 2, in from_engine
File "/usr/local/lib/python3.11/site-packages/sqlalchemy/util/deprecations.py", line 386, in warned
return fn(*args, **kwargs) # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/reflection.py", line 309, in from_engine
return cls._construct(cls._init_legacy, bind)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/reflection.py", line 246, in _construct
init(self, bind)
File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/reflection.py", line 253, in _init_legacy
self._init_engine(bind)
File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/reflection.py", line 257, in _init_engine
engine.connect().close()
^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'MockConnection' object has no attribute 'close'
root@684d040bf15d:/app/backend/open_webui# alembic branches
root@684d040bf15d:/app/backend/open_webui# alembic upgrade head
INFO [alembic.runtime.migration] Context impl SQLiteImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
INFO [alembic.runtime.migration] Running upgrade 374d2f66af06 -> 8452d01d26d7, Add chat_message table
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
self.dialect.do_execute(
File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 952, in do_execute
cursor.execute(statement, parameters)
sqlite3.OperationalError: table chat_message already exists
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/bin/alembic", line 10, in
sys.exit(main())
^^^^^^
File "/usr/local/lib/python3.11/site-packages/alembic/config.py", line 1047, in main
CommandLine(prog=prog).main(argv=argv)
File "/usr/local/lib/python3.11/site-packages/alembic/config.py", line 1037, in main
self.run_cmd(cfg, options)
File "/usr/local/lib/python3.11/site-packages/alembic/config.py", line 971, in run_cmd
fn(
File "/usr/local/lib/python3.11/site-packages/alembic/command.py", line 483, in upgrade
script.run_env()
File "/usr/local/lib/python3.11/site-packages/alembic/script/base.py", line 545, in run_env
util.load_python_file(self.dir, "env.py")
File "/usr/local/lib/python3.11/site-packages/alembic/util/pyfiles.py", line 116, in load_python_file
module = load_module_py(module_id, path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/alembic/util/pyfiles.py", line 136, in load_module_py
spec.loader.exec_module(module) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "/app/backend/open_webui/migrations/env.py", line 108, in
run_migrations_online()
File "/app/backend/open_webui/migrations/env.py", line 102, in run_migrations_online
context.run_migrations()
File "", line 8, in run_migrations
File "/usr/local/lib/python3.11/site-packages/alembic/runtime/environment.py", line 969, in run_migrations
self.get_context().run_migrations(**kw)
File "/usr/local/lib/python3.11/site-packages/alembic/runtime/migration.py", line 626, in run_migrations
step.migration_fn(**kw)
File "/app/backend/open_webui/migrations/versions/8452d01d26d7_add_chat_message_table.py", line 27, in upgrade
op.create_table(
File "", line 8, in create_table
File "", line 3, in create_table
File "/usr/local/lib/python3.11/site-packages/alembic/operations/ops.py", line 1331, in create_table
return operations.invoke(op)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/alembic/operations/base.py", line 452, in invoke
return fn(self, operation)
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/alembic/operations/toimpl.py", line 140, in create_table
operations.impl.create_table(table, **kw)
File "/usr/local/lib/python3.11/site-packages/alembic/ddl/impl.py", line 440, in create_table
self._exec(schema.CreateTable(table, **kw))
File "/usr/local/lib/python3.11/site-packages/alembic/ddl/impl.py", line 256, in _exec
return conn.execute(construct, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1419, in execute
return meth(
^^^^^
File "/usr/local/lib/python3.11/site-packages/sqlalchemy/sql/ddl.py", line 187, in _execute_on_connection
return connection._execute_ddl(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1530, in _execute_ddl
ret = self._execute_context(
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context
return self._exec_single_context(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context
self._handle_dbapi_exception(
File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 2363, in _handle_dbapi_exception
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context
self.dialect.do_execute(
File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 952, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) table chat_message already exists
[SQL:
CREATE TABLE chat_message (
id TEXT NOT NULL,
chat_id TEXT NOT NULL,
user_id TEXT,
role TEXT NOT NULL,
parent_id TEXT,
content JSON,
output JSON,
model_id TEXT,
files JSON,
sources JSON,
embeds JSON,
done BOOLEAN,
status_history JSON,
error JSON,
usage JSON,
created_at BIGINT,
updated_at BIGINT,
PRIMARY KEY (id),
FOREIGN KEY(chat_id) REFERENCES chat (id) ON DELETE CASCADE
)
]
(Background on this error at: https://sqlalche.me/e/20/e3q8)
Additional Information
No response
@Classic298 commented on GitHub (Feb 14, 2026):
https://docs.openwebui.com/troubleshooting/manual-database-migration