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


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?


[WARN] :   Sync: Puller@b6d3bc50[]: starting ChangeTracker with since=6708
[WARN] :   Sync: Puller@b6d3bc50[]: 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: processNow() called
[WARN] :   Sync: Puller@b6d3bc50[]: ChangeTracker com.couchbase.lite.replicator.ChangeTracker@b6cc3ef0 stopped
[TRACE] :  Sync: unschedule() called
[TRACE] :  Sync: processNow() called
[TRACE] :  Sync: 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: processNow() called
[INFO] :   Sync: Puller@b6d3bc50[] inserting 1 revisions...
[WARN] :   Sync: Puller@b6d3bc50[]: failed to write {undefined #2-c7680c07e214f0bce47e0549bcdf31ec}: status=400
[ERROR] :  Sync: Puller@b6d3bc50[]: Progress: set error = org.apache.http.client.HttpResponseException

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

1 Answer

« Back to question.

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.

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

Thanks so much for reporting this!