[Bug]: Client crash after many "Sqlite prepare statement error: "database is locked""
⚠️ Before submitting, please verify the following: ⚠️
- [x] This is a bug, not a question or a configuration issue.
- [x] This issue is not already reported on Github (I've searched it).
- [x] Nextcloud Server and Desktop Client are up to date. See Server Maintenance and Release Schedule and Desktop Releases for supported versions.
- [x] I agree to follow Nextcloud's Code of Conduct
Bug description
Since some time (can't remember when), the NC desktop client regularly display sync error then crash and restart after a moment. I have many different folders synced from two servers, with lot of excludes that is re-synced after restart.
In the log :
2025-12-01 02:23:46:230 [ warning nextcloud.sync.database.sql ./src/common/ownsql.cpp:253 ]: Sqlite prepare statement error: "database is locked" in "PRAGMA quick_check;"
2025-12-01 02:23:46:230 [ warning nextcloud.sync.database.sql ./src/common/ownsql.cpp:85 ]: Error preparing quick_check on database
2025-12-01 02:23:46:230 [ critical nextcloud.sync.database.sql ./src/common/ownsql.cpp:138 ]: Consistency check failed, removing broken db "/media/wargreen/Cagette/KompleX KapharnauM/.sync_04e5b023b31e.db"
2025-12-01 02:23:46:245 [ info nextcloud.sync.database ./src/common/syncjournaldb.cpp:335 ]: sqlite3 version "3.46.1"
2025-12-01 02:23:46:245 [ info nextcloud.sync.database ./src/common/syncjournaldb.cpp:347 ]: sqlite3 locking_mode= "exclusive"
2025-12-01 02:23:46:245 [ info nextcloud.sync.database ./src/common/syncjournaldb.cpp:355 ]: sqlite3 journal_mode= "wal"
2025-12-01 02:23:46:337 [ info nextcloud.sync.database ./src/common/syncjournaldb.cpp:377 ]: sqlite3 synchronous= "NORMAL"
2025-12-01 02:23:46:382 [ info nextcloud.sync.database ./src/common/syncjournaldb.cpp:2491 ]: Forcing remote re-discovery by deleting folder Etags
2025-12-01 02:23:46:382 [ info nextcloud.gui.folder.manager ./src/gui/folderman.cpp:1306 ]: Adding folder to Folder Map OCC::Folder(0x563cd840b1d0) "14"
2025-12-01 02:23:46:451 [ info nextcloud.gui.folder.manager ./src/gui/folderman.cpp:737 ]: Schedule folder "14" to sync!
2025-12-01 02:23:46:451 [ info nextcloud.gui.folder.manager ./src/gui/folderman.cpp:750 ]: Folder is not ready to sync, not scheduled!
2025-12-01 02:23:46:451 [ info nextcloud.sync.configfile ./src/libsync/configfile.cpp:1302 ]: Adding user defined ignore list to csync: "/home/wargreen/.config/Nextcloud/sync-exclude.lst"
2025-12-01 02:25:28:638 [ warning nextcloud.sync.database.sql ./src/common/ownsql.cpp:253 ]: Sqlite prepare statement error: "database is locked" in "PRAGMA quick_check;"
2025-12-01 02:25:28:638 [ warning nextcloud.sync.database.sql ./src/common/ownsql.cpp:85 ]: Error preparing quick_check on database
2025-12-01 02:25:28:638 [ critical nextcloud.sync.database.sql ./src/common/ownsql.cpp:138 ]: Consistency check failed, removing broken db "/media/wargreen/***redacted***/.sync_d84ece4ec6f4.db"
2025-12-01 02:25:28:644 [ info nextcloud.sync.database ./src/common/syncjournaldb.cpp:335 ]: sqlite3 version "3.46.1"
2025-12-01 02:25:28:644 [ info nextcloud.sync.database ./src/common/syncjournaldb.cpp:347 ]: sqlite3 locking_mode= "exclusive"
2025-12-01 02:25:28:644 [ info nextcloud.sync.database ./src/common/syncjournaldb.cpp:355 ]: sqlite3 journal_mode= "wal"
2025-12-01 02:25:28:724 [ info nextcloud.sync.database ./src/common/syncjournaldb.cpp:377 ]: sqlite3 synchronous= "NORMAL"
2025-12-01 02:25:28:740 [ info nextcloud.sync.database ./src/common/syncjournaldb.cpp:2491 ]: Forcing remote re-discovery by deleting folder Etags
2025-12-01 02:25:28:740 [ info nextcloud.gui.folder.manager ./src/gui/folderman.cpp:1306 ]: Adding folder to Folder Map OCC::Folder(0x563cd8452980) "2"
2025-12-01 02:25:28:762 [ info nextcloud.gui.folder.manager ./src/gui/folderman.cpp:737 ]: Schedule folder "2" to sync!
2025-12-01 02:25:28:762 [ info nextcloud.gui.folder.manager ./src/gui/folderman.cpp:750 ]: Folder is not ready to sync, not scheduled!
2025-12-01 02:25:28:762 [ info nextcloud.sync.configfile ./src/libsync/configfile.cpp:1302 ]: Adding user defined ignore list to csync: "/home/wargreen/.config/Nextcloud/sync-exclude.lst"
2025-12-01 02:27:10:944 [ warning nextcloud.sync.database.sql ./src/common/ownsql.cpp:253 ]: Sqlite prepare statement error: "database is locked" in "PRAGMA quick_check;"
2025-12-01 02:27:10:944 [ warning nextcloud.sync.database.sql ./src/common/ownsql.cpp:85 ]: Error preparing quick_check on database
2025-12-01 02:27:10:944 [ critical nextcloud.sync.database.sql ./src/common/ownsql.cpp:138 ]: Consistency check failed, removing broken db "/media/wargreen/***redacted***Synchro/.sync_baeee5e0f979.db"
The log folder seem to be full of new logs :
....
20251201_0248_nextcloud.log.2.gz
20251201_0248_nextcloud.log.3.gz
20251201_0248_nextcloud.log.4.gz
20251201_0248_nextcloud.log.5.gz
20251201_0248_nextcloud.log.6.gz
20251201_0248_nextcloud.log.7.gz
20251201_0248_nextcloud.log.8.gz
20251201_0248_nextcloud.log.9.gz
20251201_0248_permanent_delete.log.0
20251201_0249_nextcloud.log.0.gz
20251201_0249_nextcloud.log.10
20251201_0249_nextcloud.log.11
20251201_0249_nextcloud.log.1.gz
20251201_0249_nextcloud.log.2.gz
20251201_0249_nextcloud.log.3.gz
20251201_0249_nextcloud.log.4.gz
20251201_0249_nextcloud.log.5.gz
20251201_0249_nextcloud.log.6.gz
20251201_0249_nextcloud.log.7.gz
20251201_0249_nextcloud.log.8.gz
20251201_0249_nextcloud.log.9.gz
The last lines before a crash-and-restart :
2025-12-01 02:49:23:319 [ info nextcloud.sync.engine ./src/libsync/syncengine.cpp:921 ]: Sync run took 71824 ms
2025-12-01 02:49:23:320 [ info nextcloud.gui.folder ./src/gui/folder.cpp:1266 ]: Client version 4.0.1-2 (Debian built) Qt 6.9.2 SSL OpenSSL 3.5.4 30 Sep 2025
2025-12-01 02:49:23:320 [ info nextcloud.gui.folder ./src/gui/folder.cpp:1275 ]: SyncEngine finished without problem.
2025-12-01 02:49:23:320 [ info nextcloud.gui.folder ./src/gui/folder.cpp:436 ]: Folder "" sync result: OCC::SyncResult::NotYetStarted
2025-12-01 02:49:23:320 [ info nextcloud.gui.application ./src/gui/owncloudgui.cpp:244 ]: Sync state changed for folder "https://cloud.latendresse.fr/remote.php/dav/files/wargreen/" : "Success, some files were ignored."
Steps to reproduce
Not sure.
Expected behavior
Don't crash, reliable sync
Which files are affected by this bug
CE_VALKA_OK.wav, IMG_1275 (1).jpg
Operating system
Linux
Which version of the operating system you are running.
Debian SID
Package
Distro package manager
Nextcloud Server version
31.0.10
Nextcloud Desktop Client version
4.0.1-2
Is this bug present after an update or on a fresh install?
Updated from a minor version (ex. 3.16.1 to 3.16.2)
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
Are you using an external user-backend?
- [x] Default internal user-backend
- [ ] LDAP/ Active Directory
- [ ] SSO - SAML
- [ ] Other
Nextcloud Server logs
None related.
Additional info
Can send a debug archive in a private way.
Update
I have managed to get it working, by disabling the sync of a directory that contain few git repos with few thousands of files. Enabling these dir one by one make all the dirs gone synced and all seem work well now.