Couchbase Lite Android – Replicator fails with Invalid docID/revID in incoming change list (CBL 3.3.2 / 4.x + Sync Gateway 3.2.4, collections enabled)

Replication initially connects correctly to Sync Gateway, but fails when processing document updates.

  • First revision of a document replicates correctly

  • Subsequent updates (new revisions) fail

  • Replicator reports with the following error:

Obj=/JRepl@257665746/C4RemoteRepl#12/Repl#13/RevFinder#17/ Coll=0
Got LiteCore error: LiteCore RemoteError,
"Invalid docID/revID 'TEST-11' #21-60889ee08c9f5805ab488432a14a82cb
in incoming change list"

The document ID is valid and simple (TEST-11), and the revision ID format (21-<hash>) looks correct.

Additional Observations

  • Error occurs only on document updates, not on initial creation

  • Happens with both CBL 3.3.2 and CBL 4.0.2

  • Same Sync Gateway database works correctly with Couchbase Lite Flutter

  • Android version fails consistently

  • Replicator log shows Coll=0

  • Sync Gateway database is configured using collections (bucket.scope.collection)

Replication URL is correct (ws/wss://host/dbname, no /_blipsync)

Earlier Related Errors

  • Before this error, replication sometimes failed with:

    SQLite error (code 1): fl_callback: exception!
    
    

    That was triggered during replication of updated documents and appeared related to document body decoding (Fleece).

    After changing versions, the error evolved into the current Invalid docID/revID error.

Can you supply the Sync Gateway debug logs with all log keys for this replication, looking at correlation ID for this replication as well as /{keyspace}/_raw/{docID} output Sync Gateway Admin API Reference | Couchbase Docs .

I only care any metadata from the raw output, so you can redact any document data.

Hello, thanks for your reply. Here’s an output from the GET method:
{

    {
    "_class": "com.example.couchbase.domain.model.ConfiguracionIADocument",
    "addDate": 1768944396162,
    "addUser": 1,
    "analyzerConfig": {
        "minConfidence": 0.5,
        "thresholdOk": 85,
        "thresholdWarning": 40,
        "weights": {
            "truck": 0.0
        }
    },
    "documentId": "TEST-11",
    "estatus": true,
    "obra": "TEST-11",
    "obraId": "TEST-11",
    "updDate": 1768946662435,
    "updUser": 1,
    "_sync": {
        "rev": "2-9c45a68a4d1c095e7242efacd59d7118",
        "sequence": 35,
        "recent_sequences": [
            32,
            35
        ],
        "cas": "0x000069019e8f8c18",
        "value_crc32c": "0x5e30fdd2",
        "channel_set": null,
        "channel_set_history": null,
        "time_saved": "2026-01-20T22:04:22.440706721Z",
        "cluster_uuid": "d83b25c0c736691f16c39b91fec41376",
        "history": {
            "revs": [
                "2-9c45a68a4d1c095e7242efacd59d7118",
                "1-56646637cbff6ef9036ad07e1212097e"
            ],
            "parents": [
                1,
                -1
            ],
            "channels": [
                null,
                null
            ]
        }
    }
}

My suspicion is your CBL database exists in CBL 4.0 mode, which isn’t backward compatible.

Notably, CBL 4.0 can not talk to Sync Gateway < 4.0, and there haven’t always been good errors reported Jira when this happens. Sync Gateway 4.0 is compatible with all versions of Couchbase Lite, so updating Sync Gateway might fix this issue.

I do not think it is possible to fix the Couchbase Lite database to go back to a Sync Gateway 3.x client, it would need to be recreated with Couchbase Lite 3.x

Thanks for the help. I used CBLite version 3.3.1 and restarted the database and everything worked perfectly.