From 5feb670199909f6fb7dddeb677fa0f44864ef025 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Fri, 4 Sep 2026 21:07:58 +0200 Subject: [PATCH] fix: stop creating an empty legacy chat database for users who never had local chats Open WebUI opens the legacy 'Chats' IndexedDB on startup to look for chats that predate server-side storage. That open call carries no upgrade callback, so for anyone who never had local chats it creates the database instead of merely probing for it, and the read that follows fails against the missing object store and is swallowed. Every such user ends up with an empty 'Chats' database sitting in browser storage, recreated on every load. The upgrade callback now aborts, which rolls the implicit creation back, so nothing is left behind and the open rejects into the existing catch. Users with a real legacy database are unaffected: their upgrade never fires, and their chats are still read and offered for export. Measured in Chrome against the real idb build: indexedDB.databases() goes from listing an empty Chats entry after every load to listing nothing, with no unhandled rejection and no connection left open. This stops new empty databases from being created. Removing the ones earlier builds already left behind needs the connection closed before the delete, and is handled separately. Spotted while investigating #29538. --- src/routes/(app)/+layout.svelte | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/routes/(app)/+layout.svelte b/src/routes/(app)/+layout.svelte index 0c96091268..e9d146e2fc 100644 --- a/src/routes/(app)/+layout.svelte +++ b/src/routes/(app)/+layout.svelte @@ -72,7 +72,13 @@ const checkLocalDBChats = async () => { try { // Check if IndexedDB exists - DB = await openDB('Chats', 1); + DB = await openDB('Chats', 1, { + upgrade: (db, oldVersion, newVersion, tx) => { + // Only probing for a legacy database, so undo the implicit creation; nothing awaits tx.done + tx.done.catch(() => {}); + tx.abort(); + } + }); if (!DB) { return;