Issue: SqlCipher 4.5.4 file is not a database: , while compiling: select count(*) from sqlite_master;

Hello everyone,
In my open source project KeyPass,
I recently released a new version v1.4.29 I am getting this error for some of the users, but i am not able to replicate this.

Exception android.database.sqlite.SQLiteException: file is not a database: , while compiling: select count(*) from sqlite_master;
  at net.sqlcipher.database.SQLiteCompiledSql.native_compile (
  at net.sqlcipher.database.SQLiteCompiledSql.compile (
  at net.sqlcipher.database.SQLiteCompiledSql.<init> (
  at net.sqlcipher.database.SQLiteProgram.<init> (
  at net.sqlcipher.database.SQLiteQuery.<init> (
  at net.sqlcipher.database.SQLiteDirectCursorDriver.query (
  at net.sqlcipher.database.SQLiteDatabase.rawQueryWithFactory (
  at net.sqlcipher.database.SQLiteDatabase.rawQuery (
  at net.sqlcipher.database.SQLiteDatabase.keyDatabase (
  at net.sqlcipher.database.SQLiteDatabase.openDatabaseInternal (
  at net.sqlcipher.database.SQLiteDatabase.openDatabase (
  at net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase (
  at net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase (
  at net.sqlcipher.database.SupportHelper.getWritableDatabase (
  at (RoomDatabase.kt:5)
  at (RoomDatabase.kt:5)
  at com.yogeshpaliyal.common.db.DbDao_Impl.getAllAccountsAscending (
  at com.yogeshpaliyal.keypass.ui.home.DashboardViewModel$queryUpdated$1.invokeSuspend (DashboardViewModel.kt:129)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:9)
  at (DispatchedTask.kt:97)
  at (Tasks.kt:3)
  at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely (
  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask (CoroutineScheduler.kt:92)
  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker (CoroutineScheduler.kt:92)
  at kotlinx.coroutines.scheduling.CoroutineScheduler$ (CoroutineScheduler.kt:92)

We were not seeing this issue in v1.4.28 but getting in v1.4.29 and there is no changes releated to DB, sqlcipher, room, etc.

Here is the change logs from v1.4.28 → v1.4.29

Here is my SqlCipher file where I am initiating the DB. AppModule.kt

Thanks in advance

Hello @YogeshPaliyal - That error indicates that the derived key for a database is unable to encrypt the data. This could indicate, in order of likelihood:

  1. The key material provided to open the database is incorrect
  2. There is a mismatch in encryption settings, e.g. trying to open a version 3 database with SQLCipher 4 without compatibility settings, or custom settings were used.
  3. All or a portion of the database has been corrupted

Agree, but there is no recent changes related to db, can it be because of AGP bump?

It is extremely unlikely that it is related to an AGP bump.

If you are able to reproduce the issue, I would suggest extracting an affected database from the android device and testing on the command line.