Couchbase Lite Android – Failed to save remote checkpoint (HTTP 404 "No previous revision to replace")

Hi,
I’m trying to set up a Couchbase Lite replicator in an Android Java app that connects to a client’s Couchbase Server.

Versions:

  • Couchbase Server: 7.1.0 (build 2556)
  • Couchbase Lite for Android: 3.2.3

Problem:

I’m using a pull-only replicator for a specific collection.
On the first sync, everything works fine and the documents are downloaded correctly.

However, when a change is later made on the server and I receive the update through Sync Gateway, I see the following error in the logs:

Obj=/JRepl@1931040951/C4RemoteRepl#6/Repl#12/ CorrID=33f45df1 Got error response: HTTP 404 'No previous revision to replace'

Followed by this warning:

Obj=/JRepl@1931040951/C4RemoteRepl#6/Repl#12/ CorrID=33f45df1 Coll=0 Failed to save remote checkpoint!

After that, the replicator stays in IDLE state (even though the update is correctly received), and it logs the same error every time a new change is pulled from the server.

The First time couchbase make this request:

Saving remote checkpoint 'cp-BspfbRIU7g6O8wILiwSY4TkFKhm1BPLQ29auoc76ccw=' over rev='0-1': {"time":1750434380,"local":1,"remote":"4287::4369"} ...
17:46:20.533  I  SENDING: REQ #0  {
                 	Profile: setCheckpoint
                 	collection: 0
                 	client: cp-BspfbRIU7g6O8wILiwSY4TkFKhm1BPLQ29auoc76ccw=
                 	rev: 0-1
                 	BODY: { ... } }

And everything goes well

The second time, after receiving the document updated, couchbase make this request:

SENDING: REQ #0  {
                 	Profile: setCheckpoint
                 	collection: 0
                 	client: cp-BspfbRIU7g6O8wILiwSY4TkFKhm1BPLQ29auoc76ccw=
                 	rev: 0-2
                 	BODY: { ... } }

With this answer:

RECEIVED: ERR #11  {
                 	Error-Domain: HTTP
                 	Error-Code: 404
                 	BODY: { ... } }

Question:

Why is the checkpoint failing to save with HTTP 404?
Is there something I need to reset or configure differently on the Sync Gateway or Couchbase Server to allow proper checkpoint updates?
Any idea how to fix or work around this?

Thanks in advance!

Hi, do you have complete logs?