Strange error when saving document to db

The following error occurs:

CouchbaseLiteException{domain=1, code=25, msg=must be called during a transaction}

System.err: at com.couchbase.lite.internal.bridge.LiteCoreBridge.convertException(LiteCoreBridge.java:22)

System.err: at com.couchbase.lite.Document.save(Document.java:509)

System.err: at com.couchbase.lite.Document.save(Document.java:423)

System.err: at com.couchbase.lite.Database.save(Database.java:216)

Why is it? It’s happening from time to time…

Which version of couchbase lite are you using, and on which platform? Also can you post a code sample from you application?

Android, cbite 2.0 release 14.
The following occurs when saving document to DB

This looks like a bug in the Java code around the Couchbase Lite core.
Could you update to the latest developer build (16, I believe) and see if it still happens?

Yes, I’m using DB 21. The issue occurs, when the app is doing a lot of inserting while there is a live query running.
There’s no way to recover from it.

Can you provide some more details . Does the problem happen if the pull replicator is saving a whole bunch of documents (as a result of a pull) or if your Android app is saving a whole bunch of documents ?

If the latter, can you share the code snippet that you are using to save the documents. For instance, do you batch them?

Already did: