From d85eb36a72a5355ea3272b4aef7651cde5f6b8cb Mon Sep 17 00:00:00 2001 From: rob Date: Thu, 1 Jan 2026 05:50:03 -0400 Subject: [PATCH] Fix SQLite WAL mode error on FUSE filesystems MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WAL mode can fail on filesystems like mergerfs that don't fully support memory-mapped files. Add graceful fallback to DELETE journal mode. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- src/smarttools/registry/db.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/smarttools/registry/db.py b/src/smarttools/registry/db.py index 1a1ace5..71956d7 100644 --- a/src/smarttools/registry/db.py +++ b/src/smarttools/registry/db.py @@ -245,7 +245,13 @@ def connect_db(path: Path | None = None) -> sqlite3.Connection: ensure_db_directory(db_path) conn = sqlite3.connect(db_path) conn.row_factory = sqlite3.Row - conn.execute("PRAGMA journal_mode=WAL;") + # WAL mode provides better concurrency but may not work on all filesystems + # (e.g., some FUSE filesystems like mergerfs). Fall back gracefully. + try: + conn.execute("PRAGMA journal_mode=WAL;") + except sqlite3.OperationalError: + # Fall back to DELETE journal mode which works everywhere + conn.execute("PRAGMA journal_mode=DELETE;") conn.execute("PRAGMA foreign_keys=ON;") return conn