Logging shows exception but data is saved correctly

I’m using CBL 3.2.2 for Android (on a side note the link to the API is not working yet: Couchbase Documentation | Couchbase Docs) and noticed when saving a document the following exception is thrown (log level WARNING, log domain DATABASE) which is not caught in my code, i.e., it is caught in the library:

[JAVA] Lite Core exception
com.couchbase.lite.LiteCoreException: conflict [1, 8]
at com.couchbase.lite.internal.core.impl.NativeC4Document.createFromSlice(Native Method)
at com.couchbase.lite.internal.core.impl.NativeC4Document.nCreateFromSlice(NativeC4Document.java:36)
at com.couchbase.lite.internal.core.C4Document.lambda$create$0(C4Document.java:90)
at com.couchbase.lite.internal.core.C4Document$$ExternalSyntheticLambda10.apply(D8$$SyntheticClass:0)
at com.couchbase.lite.internal.core.C4Peer.withPeerOrThrow(C4Peer.java:264)
at com.couchbase.lite.internal.core.C4Document.create(C4Document.java:88)
at com.couchbase.lite.internal.core.C4Collection.createDocument(C4Collection.java:215)
at com.couchbase.lite.Collection.createC4Document(Collection.java:583)
at com.couchbase.lite.Collection.saveInTransaction(Collection.java:944)
at com.couchbase.lite.Collection.saveLocked(Collection.java:676)
at com.couchbase.lite.Collection.lambda$save$2$com-couchbase-lite-Collection(Collection.java:241)
at com.couchbase.lite.Collection$$ExternalSyntheticLambda10.get(D8$$SyntheticClass:0)
at com.couchbase.lite.Collection.withLockAndOpenDb(Collection.java:875)
at com.couchbase.lite.Collection.save(Collection.java:240)
at com.couchbase.lite.Collection.save(Collection.java:225)

Right before the exception the log (level=debug) shows:

I … SELECT sequence, flags, null, version, length(body), length(extra) FROM “kv_del_.table\Orders” WHERE key=?
I … SELECT lastSeq FROM kvmeta WHERE name=?
V Obj=/DB#2/ KeyStore(.tableOrders) insert 6d094307309a4de3bf743eda7fbcfdf9
I … INSERT OR IGNORE INTO “kv_.table\Orders” (version, body, extra, flags, sequence, key) VALUES (?, ?, ?, ?, ?, ?)
I Compiling SQL “SELECT sequence, flags, null, version, body, extra FROM “kv_.table\Orders” WHERE key=?”
I … SELECT sequence, flags, null, version, body, extra FROM “kv_.table\Orders” WHERE key=?

I’m not sure if this is really an issue since the data is saved correctly.

Do you have any advice?

There is already a ticket for this - it can be ignored. And the logging strategy is being re-evaluated.

Thank you for clarifying this for me.

Yes, what @mreiche said. That is simply a log message.
Exceptions are a standard method used by Java programs to handle exceptional cases. If your program does not have to handle the exception, there is no reason for you to be concerned about it.

1 Like