# Issue: SqlCipher 4.5.4 file is not a database: , while compiling: select count(\*) from sqlite\_master;

**URL:** <https://discuss.zetetic.net/t/issue-sqlcipher-4-5-4-file-is-not-a-database-while-compiling-select-count-from-sqlite-master/6513>\
**Category:** Issues\
**Created:** [June 26, 2024, 6:36pm UTC](https://discuss.zetetic.net/t/issue-sqlcipher-4-5-4-file-is-not-a-database-while-compiling-select-count-from-sqlite-master/6513 "2024-06-26T18:36:04Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![YogeshPaliyal](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/yogeshpaliyal/32/2253_2.png) [@YogeshPaliyal](https://discuss.zetetic.net/u/YogeshPaliyal)\
**Post date:** [June 26, 2024, 6:36pm UTC](https://discuss.zetetic.net/t/issue-sqlcipher-4-5-4-file-is-not-a-database-while-compiling-select-count-from-sqlite-master/6513/1 "2024-06-26T18:36:04Z")

</div>

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.

```auto
Exception android.database.sqlite.SQLiteException: file is not a database: , while compiling: select count(*) from sqlite_master;
  at net.sqlcipher.database.SQLiteCompiledSql.native_compile (SQLiteCompiledSql.java)
  at net.sqlcipher.database.SQLiteCompiledSql.compile (SQLiteCompiledSql.java)
  at net.sqlcipher.database.SQLiteCompiledSql.<init> (SQLiteCompiledSql.java)
  at net.sqlcipher.database.SQLiteProgram.<init> (SQLiteProgram.java)
  at net.sqlcipher.database.SQLiteQuery.<init> (SQLiteQuery.java:2)
  at net.sqlcipher.database.SQLiteDirectCursorDriver.query (SQLiteDirectCursorDriver.java:2)
  at net.sqlcipher.database.SQLiteDatabase.rawQueryWithFactory (SQLiteDatabase.java)
  at net.sqlcipher.database.SQLiteDatabase.rawQuery (SQLiteDatabase.java:2)
  at net.sqlcipher.database.SQLiteDatabase.keyDatabase (SQLiteDatabase.java)
  at net.sqlcipher.database.SQLiteDatabase.openDatabaseInternal (SQLiteDatabase.java:1)
  at net.sqlcipher.database.SQLiteDatabase.openDatabase (SQLiteDatabase.java:4)
  at net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase (SQLiteDatabase.java:9)
  at net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase (SQLiteOpenHelper.java:2)
  at net.sqlcipher.database.SupportHelper.getWritableDatabase (SupportHelper.java:6)
  at androidx.room.RoomDatabase.inTransaction (RoomDatabase.kt:5)
  at androidx.room.RoomDatabase.assertNotSuspendingTransaction (RoomDatabase.kt:5)
  at com.yogeshpaliyal.common.db.DbDao_Impl.getAllAccountsAscending (DbDao_Impl.java:129)
  at com.yogeshpaliyal.keypass.ui.home.DashboardViewModel$queryUpdated$1.invokeSuspend (DashboardViewModel.kt:129)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:9)
  at kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:97)
  at kotlinx.coroutines.scheduling.TaskImpl.run (Tasks.kt:3)
  at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely (CoroutineScheduler.java:92)
  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$Worker.run (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](https://github.com/yogeshpaliyal/KeyPass/compare/v1.4.28...v1.4.29)

Here is my SqlCipher file where I am initiating the DB. [AppModule.kt](https://github.com/yogeshpaliyal/KeyPass/blob/master/common/src/main/java/com/yogeshpaliyal/common/di/module/AppModule.kt)

Thanks in advance

---

<div class="post-metadata">

**Author:** ![sjlombardo](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/sjlombardo/32/3_2.png) [@sjlombardo](https://discuss.zetetic.net/u/sjlombardo)\
**Post date:** [June 28, 2024, 5:06pm UTC](https://discuss.zetetic.net/t/issue-sqlcipher-4-5-4-file-is-not-a-database-while-compiling-select-count-from-sqlite-master/6513/2 "2024-06-28T17:06:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![YogeshPaliyal](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/yogeshpaliyal/32/2253_2.png) [@YogeshPaliyal](https://discuss.zetetic.net/u/YogeshPaliyal)\
**Post date:** [June 28, 2024, 6:20pm UTC](https://discuss.zetetic.net/t/issue-sqlcipher-4-5-4-file-is-not-a-database-while-compiling-select-count-from-sqlite-master/6513/3 "2024-06-28T18:20:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sjlombardo](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/sjlombardo/32/3_2.png) [@sjlombardo](https://discuss.zetetic.net/u/sjlombardo)\
**Post date:** [June 28, 2024, 7:52pm UTC](https://discuss.zetetic.net/t/issue-sqlcipher-4-5-4-file-is-not-a-database-while-compiling-select-count-from-sqlite-master/6513/4 "2024-06-28T19:52:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Upendar\_Kumar](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/upendar_kumar/32/2285_2.png) [@Upendar\_Kumar](https://discuss.zetetic.net/u/Upendar_Kumar)\
**Post date:** [December 8, 2024, 3:22pm UTC](https://discuss.zetetic.net/t/issue-sqlcipher-4-5-4-file-is-not-a-database-while-compiling-select-count-from-sqlite-master/6513/5 "2024-12-08T15:22:45Z")

</div>

Hi sir my name is satish kumar please my apps open and my S Gallery not Usable please help me open please I request you sir

---

<div class="post-metadata">

**Author:** ![Upendar\_Kumar](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/upendar_kumar/32/2285_2.png) [@Upendar\_Kumar](https://discuss.zetetic.net/u/Upendar_Kumar)\
**Post date:** [December 8, 2024, 3:03pm UTC](https://discuss.zetetic.net/t/issue-sqlcipher-4-5-4-file-is-not-a-database-while-compiling-select-count-from-sqlite-master/6513/6 "2024-12-08T15:03:23Z")

</div>

Sgallery my apps error code please help me Sir I request you please open s gallery Apps

 ![IMG_20241208_202954](https://us1.discourse-cdn.com/flex016/uploads/zetetic/original/2X/4/42749dd3f546575614da73c2c0e08a617fec27fe.jpeg)

---

<div class="post-metadata">

**Author:** ![Layth17](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/layth17/32/2372_2.png) [@Layth17](https://discuss.zetetic.net/u/Layth17)\
**Post date:** [January 30, 2025, 6:19pm UTC](https://discuss.zetetic.net/t/issue-sqlcipher-4-5-4-file-is-not-a-database-while-compiling-select-count-from-sqlite-master/6513/7 "2025-01-30T18:19:14Z")

</div>

Hello,

I’m experiencing the same issue when I updated to 1.4.34 today

---

<div class="post-metadata">

**Author:** ![YogeshPaliyal](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/yogeshpaliyal/32/2253_2.png) [@YogeshPaliyal](https://discuss.zetetic.net/u/YogeshPaliyal)\
**Post date:** [February 3, 2025, 6:40pm UTC](https://discuss.zetetic.net/t/issue-sqlcipher-4-5-4-file-is-not-a-database-while-compiling-select-count-from-sqlite-master/6513/8 "2025-02-03T18:40:05Z")

</div>

Thank you everyone for the participation, I am able to resolve the Issue it is not due to SqlCipher, sorry for the inconvenience.

---

<div class="post-metadata">

**Author:** ![karandalli35](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/karandalli35/32/2391_2.png) [@karandalli35](https://discuss.zetetic.net/u/karandalli35)\
**Post date:** [March 4, 2025, 12:34pm UTC](https://discuss.zetetic.net/t/issue-sqlcipher-4-5-4-file-is-not-a-database-while-compiling-select-count-from-sqlite-master/6513/9 "2025-03-04T12:34:57Z")

</div>

Hi, please advise how you solved this problem?
