Problem
In lib/main.dart (lines 32–40):
await LocalDb.initFfi();
await SyntaxHighlightService.ensureInitialized();
await ThemeController.instance.load();
await UiScaleController.instance.load();
await QueryaMotionController.instance.load();
...
runApp(const QueryaApp());
ThemeController, UiScaleController, and QueryaMotionController all call LocalDb.instance in their load() methods during startup before runApp is executed.
- If
querya.db fails to open (e.g. SQLite database locked by a stale process, file corruption, filesystem permission error, or WAL checkpoint failure):
LocalDb._doOpen() throws an unhandled exception.
- The exception is caught by
runZonedGuarded in main.dart, which only prints debugPrint('Unhandled async error: $error\n$stack').
runApp(const QueryaApp()) is never called.
- The user is presented with a blank, frozen window, with no indication of why the app failed to launch and no way to recover.
Scope
- Wrap early
LocalDb initialization and controller loads in a try-catch block in main.dart.
- If
LocalDb fails to open, launch a minimal recovery UI (QueryaStartupRecoveryApp) that presents the error message and offers recovery actions:
- Retry opening the database.
- Unlock database / remove stale WAL locks.
- Start in Safe Mode with a temporary or clean profile.
- Export/backup existing
querya.db file for diagnosis.
- Add tests verifying startup error handling when
LocalDb throws.
Problem
In
lib/main.dart(lines 32–40):ThemeController,UiScaleController, andQueryaMotionControllerall callLocalDb.instancein theirload()methods during startup beforerunAppis executed.querya.dbfails to open (e.g. SQLite database locked by a stale process, file corruption, filesystem permission error, or WAL checkpoint failure):LocalDb._doOpen()throws an unhandled exception.runZonedGuardedinmain.dart, which only printsdebugPrint('Unhandled async error: $error\n$stack').runApp(const QueryaApp())is never called.Scope
LocalDbinitialization and controller loads in a try-catch block inmain.dart.LocalDbfails to open, launch a minimal recovery UI (QueryaStartupRecoveryApp) that presents the error message and offers recovery actions:querya.dbfile for diagnosis.LocalDbthrows.