[GH-ISSUE #22568] issue: migration from 0.7.2 to 0.8.10 fails in 8452d01d26d7_add_chat_message_table.py #58417

Closed
opened 2026-05-05 23:06:57 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @ibeex on GitHub (Mar 11, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/22568

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!).
  • I am using the latest version of Open WebUI.

Installation Method

Other

Open WebUI Version

v0.8.10

Ollama Version (if applicable)

No response

Operating System

Rocky

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

We followed procedure for upgrade.

Actual Behavior

We did 2 migrations one went without problems, other one failed with error message:

Defaulted container "open-webui" out of: open-webui, copy-app-data (init), update-ca-certificates (init)
INFO:open_webui.env:GLOBAL_LOG_LEVEL: DEBUG
DEBUG:open_webui.env:No WEBSOCKET_REDIS_OPTIONS provided, defaulting to None
INFO:open_webui.internal.wrappers:Connected to PostgreSQL database
INFO:open_webui.internal.db:Starting migrations
DEBUG:peewee:('CREATE TABLE IF NOT EXISTS "migratehistory" ("id" SERIAL NOT NULL PRIMARY KEY, "name" VARCHAR(255) NOT NULL, "migrated_at" TIMESTAMP NOT NULL)', [])
DEBUG:peewee:('SELECT "t1"."id", "t1"."name", "t1"."migrated_at" FROM "migratehistory" AS "t1" ORDER BY "t1"."id"', [])
INFO:open_webui.internal.db:There is nothing to migrate
INFO:open_webui.env:Running migrations
INFO:alembic.runtime.plugins:setup plugin alembic.autogenerate.schemas
INFO:alembic.runtime.plugins:setup plugin alembic.autogenerate.tables
INFO:alembic.runtime.plugins:setup plugin alembic.autogenerate.types
INFO:alembic.runtime.plugins:setup plugin alembic.autogenerate.constraints
INFO:alembic.runtime.plugins:setup plugin alembic.autogenerate.defaults
INFO:alembic.runtime.plugins:setup plugin alembic.autogenerate.comments
INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade c440947495f3 -> 374d2f66af06, Add prompt history table
INFO  [alembic.runtime.migration] Running upgrade 374d2f66af06 -> 8452d01d26d7, Add chat_message table
ERROR [open_webui.env] Error running migrations: 'list' object has no attribute 'items'
Traceback (most recent call last):
  File "/app/backend/open_webui/config.py", line 68, in run_migrations
    command.upgrade(alembic_cfg, "head")
  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 "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/app/backend/open_webui/migrations/env.py", line 116, in <module>
    run_migrations_online()
  File "/app/backend/open_webui/migrations/env.py", line 110, in run_migrations_online
    context.run_migrations()
  File "<string>", 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 156, in upgrade
    for message_id, message in messages.items():
                               ^^^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'items'
WARNI [open_webui.env] ⚠️  SECURITY WARNING: JWT_EXPIRES_IN is set to '-1'
    See: https://docs.openwebui.com/reference/env-configuration

we fixed it with check if
history = chat_data.get("history", {})
messages = history.get("messages", {})

history or messages are dictionary for some reason in db some messages where list

Steps to Reproduce

.

Logs & Screenshots

log is in description

Additional Information

No response

Originally created by @ibeex on GitHub (Mar 11, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/22568 ### Check Existing Issues - [x] I have searched for any existing and/or related issues. - [x] I have searched for any existing and/or related discussions. - [x] I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!). - [x] I am using the latest version of Open WebUI. ### Installation Method Other ### Open WebUI Version v0.8.10 ### Ollama Version (if applicable) _No response_ ### Operating System Rocky ### 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 We followed procedure for upgrade. ### Actual Behavior We did 2 migrations one went without problems, other one failed with error message: ``` Defaulted container "open-webui" out of: open-webui, copy-app-data (init), update-ca-certificates (init) INFO:open_webui.env:GLOBAL_LOG_LEVEL: DEBUG DEBUG:open_webui.env:No WEBSOCKET_REDIS_OPTIONS provided, defaulting to None INFO:open_webui.internal.wrappers:Connected to PostgreSQL database INFO:open_webui.internal.db:Starting migrations DEBUG:peewee:('CREATE TABLE IF NOT EXISTS "migratehistory" ("id" SERIAL NOT NULL PRIMARY KEY, "name" VARCHAR(255) NOT NULL, "migrated_at" TIMESTAMP NOT NULL)', []) DEBUG:peewee:('SELECT "t1"."id", "t1"."name", "t1"."migrated_at" FROM "migratehistory" AS "t1" ORDER BY "t1"."id"', []) INFO:open_webui.internal.db:There is nothing to migrate INFO:open_webui.env:Running migrations INFO:alembic.runtime.plugins:setup plugin alembic.autogenerate.schemas INFO:alembic.runtime.plugins:setup plugin alembic.autogenerate.tables INFO:alembic.runtime.plugins:setup plugin alembic.autogenerate.types INFO:alembic.runtime.plugins:setup plugin alembic.autogenerate.constraints INFO:alembic.runtime.plugins:setup plugin alembic.autogenerate.defaults INFO:alembic.runtime.plugins:setup plugin alembic.autogenerate.comments INFO [alembic.runtime.migration] Context impl PostgresqlImpl. INFO [alembic.runtime.migration] Will assume transactional DDL. INFO [alembic.runtime.migration] Running upgrade c440947495f3 -> 374d2f66af06, Add prompt history table INFO [alembic.runtime.migration] Running upgrade 374d2f66af06 -> 8452d01d26d7, Add chat_message table ERROR [open_webui.env] Error running migrations: 'list' object has no attribute 'items' Traceback (most recent call last): File "/app/backend/open_webui/config.py", line 68, in run_migrations command.upgrade(alembic_cfg, "head") 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 "<frozen importlib._bootstrap_external>", line 940, in exec_module File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "/app/backend/open_webui/migrations/env.py", line 116, in <module> run_migrations_online() File "/app/backend/open_webui/migrations/env.py", line 110, in run_migrations_online context.run_migrations() File "<string>", 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 156, in upgrade for message_id, message in messages.items(): ^^^^^^^^^^^^^^ AttributeError: 'list' object has no attribute 'items' WARNI [open_webui.env] ⚠️ SECURITY WARNING: JWT_EXPIRES_IN is set to '-1' See: https://docs.openwebui.com/reference/env-configuration ``` we fixed it with check if history = chat_data.get("history", {}) messages = history.get("messages", {}) history or messages are dictionary for some reason in db some messages where `list` ### Steps to Reproduce . ### Logs & Screenshots log is in description ### Additional Information _No response_
GiteaMirror added the bug label 2026-05-05 23:06:57 -05:00
Author
Owner

@ibeex commented on GitHub (Mar 11, 2026):

history = chat_data.get("history", {})
messages = history.get("messages", {})

# Skip if messages is not a dict (sometimes it's a list in the database)
if not isinstance(messages, dict):
    continue

for message_id, message in messages.items():

this is fix we added in runtime

<!-- gh-comment-id:4037477759 --> @ibeex commented on GitHub (Mar 11, 2026): ``` history = chat_data.get("history", {}) messages = history.get("messages", {}) # Skip if messages is not a dict (sometimes it's a list in the database) if not isinstance(messages, dict): continue for message_id, message in messages.items(): ``` this is fix we added in runtime
Author
Owner

@Classic298 commented on GitHub (Mar 11, 2026):

https://github.com/open-webui/open-webui/pull/22588

<!-- gh-comment-id:4041109574 --> @Classic298 commented on GitHub (Mar 11, 2026): https://github.com/open-webui/open-webui/pull/22588
Author
Owner

@flefevre commented on GitHub (Mar 12, 2026):

Thanks.
We are facing exactly the same problem.
Is there a way to apply only this patch when are working with kubernetes and your official image tag?

<!-- gh-comment-id:4051071492 --> @flefevre commented on GitHub (Mar 12, 2026): Thanks. We are facing exactly the same problem. Is there a way to apply only this patch when are working with kubernetes and your official image tag?
Author
Owner

@qiaozhi199 commented on GitHub (Mar 13, 2026):

We upgraded from version v0.6.43 to v0.8.10 and encountered this issue as well.
Will this fix be included in the next release? @tjbck

<!-- gh-comment-id:4052293983 --> @qiaozhi199 commented on GitHub (Mar 13, 2026): We upgraded from version v0.6.43 to v0.8.10 and encountered this issue as well. Will this fix be included in the next release? @tjbck
Author
Owner

@Classic298 commented on GitHub (Mar 13, 2026):

@qiaozhi199 yes it will its already merged as you can see

<!-- gh-comment-id:4053707302 --> @Classic298 commented on GitHub (Mar 13, 2026): @qiaozhi199 yes it will its already merged as you can see
Author
Owner

@Classic298 commented on GitHub (Mar 13, 2026):

@flefevre yes

<!-- gh-comment-id:4053707616 --> @Classic298 commented on GitHub (Mar 13, 2026): @flefevre yes
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#58417