mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 14:39:31 -05:00
[PR #21887] [CLOSED] fix: handle non-numeric timestamp values in chat_message migration #113635
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?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/21887
Author: @npuigm
Created: 2/26/2026
Status: ❌ Closed
Base:
dev← Head:fix/migration-timestamp-type-coercion📝 Commits (2)
96636f1fix: handle non-numeric timestamp values in chat_message migratione7e7a91fix: use int(float()) to handle float-format timestamps📊 Changes
1 file changed (+7 additions, -0 deletions)
View changed files
📝
backend/open_webui/migrations/versions/8452d01d26d7_add_chat_message_table.py(+7 -0)📄 Description
Pull Request Checklist
devfix:Changelog Entry
Description
The alembic migration
8452d01d26d7_add_chat_message_table(introduced in v0.8.5) crashes when thetimestampfield inside chat message JSON data contains a non-numeric string value.Root cause: The migration reads
message.get("timestamp", now)and compares it with>and<against integers (lines 131–135). Iftimestampis a string, Python raises:This rolls back the entire migration. On the next startup, the app finds an incomplete schema and returns 500 on
/api/config, showing "Open WebUI Backend Required".How string timestamps get into the database: In our case, an automated security scanner (DAST) injected path-traversal payloads into the chat API, which were stored verbatim in the
timestampfield. Any corrupted or manually edited chat data with non-numeric timestamps would trigger the same crash.Added
Changed
Deprecated
Removed
Fixed
timestampinint()with atry/except (TypeError, ValueError)before the numeric comparisons in the8452d01d26d7migrationnow— consistent with the existing fallback for out-of-range timestampsSecurity
Breaking Changes
Additional Information
message.timestampwill crash the migrationScreenshots or Videos
N/A — this is a backend migration fix with no UI changes.
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.