mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 10:58:17 -05:00
[PR #21398] [CLOSED] fix: JSONField double deserialization on PostgreSQL #41696
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/21398
Author: @lewisco
Created: 2/13/2026
Status: ❌ Closed
Base:
dev← Head:fix/jsonfield-double-deserialization📝 Commits (1)
9a55aa6fix: handle already-deserialized JSON values from PostgreSQL📊 Changes
1 file changed (+5 additions, -2 deletions)
View changed files
📝
backend/open_webui/internal/db.py(+5 -2)📄 Description
Description
JSONField.process_result_valuecrashing withTypeErroron PostgreSQL when psycopg2 returns already-deserialized Python dicts/lists from JSONB columns. The bug surfaces most visibly when creating a new skill, asdb.refresh()triggers deserialization of themetacolumn.Discussion: https://github.com/open-webui/open-webui/discussions/21397
Added
Changed
Deprecated
Removed
Fixed
JSONField.process_result_valuenow checks whether the value is already adictorlistbefore callingjson.loads(). On PostgreSQL with psycopg2's native JSON type adaptation, JSONB columns return Python objects directly. The previous unconditionaljson.loads(value)raisedTypeError: the JSON object must be str, bytes or bytearray, not dict.Security
Breaking Changes
Additional Information
backend/open_webui/internal/db.py, 3 lines added, 2 removedpython_value(same file, lines 51-53) has the same unconditionaljson.loadsbut is left out of scope to keep this minimalTesting
PostgreSQL (live deployment, psycopg2 driver):
db.refresh())SQLite (local Docker,
ghcr.io/open-webui/open-webui:mainwith patched file bind-mounted):skill.metaskill.metaskill.metachat.chatchat.chatchat.chatuser.settingsuser.settingschat.chatOn SQLite the
isinstanceguard never triggers because values always arrive as strings, sojson.loads()runs exactly as before. Zero errors in container logs.Screenshots or Videos
N/A (backend-only change, no UI impact)
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.