User-space exception detected! java.lang.IllegalStateException: no transaction pending

User-space exception detected!
java.lang.IllegalStateException: no transaction pending
at net.sqlcipher.database.SQLiteDatabase.endTransaction(SQLiteDatabase.java:706)
at com.activeandroid.ActiveAndroid.endTransaction(ActiveAndroid.java:46)

Hi @srinivas3120

Is this something that you can reproduce? We would be happy to look into this further if you can create a test case that reproduces the error. Thanks!

I don’t know how can i reproduce this. but it happens very frequently.
what causes User-space exception detected!

All database operations are singleton.
on every upgrade, i was changing the encrypted password.

  SQLiteDatabase db = openDatabase();
  final String PRAGMA_KEY = String.format("PRAGMA key = '%s';", oldPass);
  final String PRAGMA_REKEY = String.format("PRAGMA rekey = '%s';", newPass);
  db.rawExecSQL("BEGIN IMMEDIATE TRANSACTION;");
  db.rawExecSQL(PRAGMA_KEY);
  db.rawExecSQL(PRAGMA_REKEY);

@srinivas3120 - have you tried removing the begin transaction from before the pragma key? Rekey already uses a transaction internally.

what about key ? does it use transaction internally ?

@srinivas3120 - no key doesn’t use a transaction because it does not actually touch the database.