Invalid top-level key '_removed' in document to be inserted


#1

Hello,

With couchbase-lite for android on pull I’m getting an error " Invalid top-level key ‘_removed’ in document to be inserted".
And everytime I start a new pull I keep getting this error for the same revision ID.

Is that a bug with couchbase-lite for android or should I look at something else?

Thanks,
Yuzkan

[WARN] : Sync: Puller@b6d3bc50[http://192.168.128.76:4984/dev]: starting ChangeTracker with since=6708 [WARN] : Sync: Puller@b6d3bc50[http://192.168.128.76:4984/dev]: started ChangeTracker com.couchbase.lite.replicator.ChangeTracker@b6cc3ef0 [TRACE] : Sync: not already scheduled [WARN] : ChangeTracker: com.couchbase.lite.replicator.ChangeTracker@b6cc3ef0: Change tracker calling stop (OneShot) [TRACE] : Sync: com.couchbase.lite.support.Batcher@b6df0ac8: processNow() called [WARN] : Sync: Puller@b6d3bc50[http://192.168.128.76:4984/dev]: ChangeTracker com.couchbase.lite.replicator.ChangeTracker@b6cc3ef0 stopped [TRACE] : Sync: com.couchbase.lite.support.Batcher@b6df0ac8: unschedule() called [TRACE] : Sync: com.couchbase.lite.support.Batcher@b6df0ac8: processNow() called [TRACE] : Sync: com.couchbase.lite.support.Batcher@b6df0ac8: processNow() called, but inbox is empty [TRACE] : Sync: not already scheduled [ERROR] : CBLite: Database: Invalid top-level key '_removed' in document to be inserted [TRACE] : Sync: com.couchbase.lite.support.Batcher@b6d97ca0: processNow() called [INFO] : Sync: Puller@b6d3bc50[http://192.168.128.76:4984/dev] inserting 1 revisions... [WARN] : Sync: Puller@b6d3bc50[http://192.168.128.76:4984/dev]: failed to write {undefined #2-c7680c07e214f0bce47e0549bcdf31ec}: status=400 [ERROR] : Sync: Puller@b6d3bc50[http://192.168.128.76:4984/dev]: Progress: set error = org.apache.http.client.HttpResponseException

#2

Thanks, I’ll check why/how “_removed” is being set.

I did reset the DB on the device and tried to pull everything once again. I still get that error and also I see the following error:

[WARN] : Sync: com.couchbase.lite.replicator.Replication$8@b6f0b670: Database is null, ignoring remote checkpoint response [ERROR] : RemoteRequest: Got error status: 409 for org.apache.http.client.methods.HttpPut@b6ee79e0. Reason: Conflict [WARN] : Sync: com.couchbase.lite.replicator.Replication$8@b6ed4420: Unable to save remote checkpoint [WARN] : Sync: com.couchbase.lite.replicator.Replication$8@b6ed4420: Database is null, ignoring remote checkpoint response

#3

It sounds like somebody meant to add “_deleted” to the document, and accidentally added “_removed” instead.

It is correct behavior for Couchbase Lite to complain about this invalid top level key, since “_removed” is not in the list of valid top level keys ("_id", “_rev”, “_deleted”).

I will double check if this should be an exception or just be a warning, but I think the correct fix is to rename the field in your database.


#4

On further investigation, it appears to be a bug in couchbase lite android:

Thanks so much for reporting this!