Fatal Exception on CouchBaseLite on Android

Hi everyone,
some users using my application on playstore are getting this crash:

C4Database.java
com.couchbase.litecore.C4Database.open

Fatal Exception: com.couchbase.lite.CouchbaseLiteException
file/data is not in the requested format

com.couchbase.lite.CBLStatus.convertException + 51 (CBLStatus.java:51)
com.couchbase.lite.CBLStatus.convertException + 55 (CBLStatus.java:55)
com.couchbase.lite.AbstractDatabase.open + 817 (AbstractDatabase.java:817)
com.couchbase.lite.AbstractDatabase.<init> + 127 (AbstractDatabase.java:127)
com.couchbase.lite.Database.<init> + 35 (Database.java:35)

I’m using couchbase-lite-android:2.1.2.

This means something catastrophic has happened to the data file. More than just corruption, this usually happens when some of the files inside of the cblite2 folder have been deleted from the filesystem. Without more information there is not much else I can say about that. If you are able to get your hands on a database file exhibiting the problem then perhaps I can say more.

No unfortunally are user’s device so we don’t have access to this files.
Can we prevent this crash in some ways? Maybe a try/catch?
We’re using couchbase as cache layer so if we detect that the db is broken we can delete at all and re-download infos.

It’s unlikely that a crash would cause this, which is why it is difficult to give advice. You can catch this exception when opening the database but I think your only remedy is to delete and resync.

@fnovelli Hello Francesco, my name is Fabio Gerosa from Couchbase Italy, may I help you?
Do not esitate to contact me here or on LinkedIn.
Hope to be able to chat/talk with you.
Cordiali saluti,
Fabio Gerosa