A WorkManager background task may have the database open when the foreground app starts. Executing PRAGMA journal_mode = WAL on the second connection then fails with SQLITE_BUSY_SNAPSHOT (extended code 261, primary code 5), crashing the app before it renders. Two changes: 1. Move PRAGMA busy_timeout = 5000 before the WAL pragma so SQLite auto-retries plain SQLITE_BUSY (code 5) for up to 5 s. 2. Extract setup logic into _setupPragmas and catch SqliteException with resultCode == 5 (covers both SQLITE_BUSY and SQLITE_BUSY_SNAPSHOT). SQLITE_BUSY_SNAPSHOT only occurs when the DB is already in WAL mode, so the pragma is a no-op and it is safe to continue. Adds a regression test that opens a second connection while a read transaction holds a WAL snapshot open and verifies setupPragmasForTesting does not throw. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>