Couchlite Android 2.0.0DP- invalid revisions in sync

When replicating the database, we’re seeing a lot of invalid revisions and no progress. Here’s a sample of the log (the entire log is so big Android’s log feature chokes on it):

08-18 11:37:01.681 15333-16024/com.handshake.hsdm E/CBLWebSocket: WebSocketListener.onMessage() bytes -> 952c282301007265760073657175656e636500223230343937323a3230333734322200040005001f8b080000096e8800ff8451cb8edc2010fc95559fcd0a307e1e9391a2bdcf2917ab0ded0d5a1b2c8cad1945f9f7087b6766a33944e242553faaab7e43670db4d088bcea252a464249a686ba6675af244353229a021bd53790411768831604ab24e64555aa42d68ab4e6249a5a9452963d97648a1a3240adfdea22b4703a9ddf9c4ed09490ced8e59372eb383ee095a005fecaf9a374c65d5ed1fc83069ad03aebde9fea97b58f3ee2f8dc13f1f254fd597aa8e8ed385af7de450f2d40061a43b0146eb48e764afa241715e32513ea2c659b8b362f5e0b297ea68e350472fa7a6f5997e8a73402aac20c3549ce8a4110538492351521cb73c96555230dbc800c0c8d14c9403be0b8500666a50ee3b1b564bc61b23a73deee2f6d24176dbc9eaf7352f6e6366f3525f81229381cf76c0f2df6208fb4659ea784a6ff9fe47ca4e5f0c307f370630e76c348dd173ed040e9fc7de2e9db77c184aa54d394bc4a962fe4e27ecb3160ff0ec14f47f3fedd9dffe1b7cbabf6d30e862d691e69a37b4ccb2f3b7706237d7525870c2285294939adf4e2dd4b204d768e8908a83f52b2a3751fb73177d0ad537fbbebcfdf000000ffffb93dab3c0f030000
08-18 11:37:01.681 15333-16017/com.handshake.hsdm E/C4Replicator: documentErrorCallback() handle -> 513230938784, pushing -> false, docID -> null, domain -> 7, code -> 400, internalInfo -> 6507, trans -> false
08-18 11:37:01.681 15333-16024/com.handshake.hsdm E/C4Socket: C4Socket.callback.completedReceive() socket -> 0x777ee53810, byteCount -> 480
08-18 11:37:01.681 15333-16019/com.handshake.hsdm I/LiteCore [Actor]: Pull->blips:myurl/_blipsync performNextMessage
08-18 11:37:01.681 15333-16019/com.handshake.hsdm I/LiteCore [Actor]: BLIP[->blips:myurl/_blipsync] performNextMessage
08-18 11:37:01.682 15333-16024/com.handshake.hsdm E/CBLWebSocket: WebSocketListener.onMessage() bytes -> 962c282301007265760073657175656e636500223230343937323a3230333734332200040005001f8b080000096e8800ff8451cb8e9c3010fc95559ff1ca9897cd3513457b9f532ea8b19b8db5602363d08ca2fc7b64d899c96a0e917c71553faaab7e43670db440dae8bee69c19948a9575a59822d4acd29cfa7230a8b1810cba401bb4903385aa965ce180bc1c5453f7c5c00b2259944236283864805afbd54568e1743abf399da029219db1cb27e5d6717cc02b410bfc95f347e98cbbbca2fa82069ad03aebde9fea97b58f3ee2f8dc13f1f254fd597aa8e8ed385af7de450f2d40061a43b0146eb48e764afa04cf1bc66b96976721da226fabfcb596e267ea584320a7aff79675897e4a23a0a9cc204970560d39b1925030d510b2a2105c341269e015646068a44806da01c78532302b75188fad35e38a0975e6bcdd5fda482eda783d5fe7a4eccd6dde6a4af025527038eed91e5aec411e698b424ac860faff49ce475a0e3f7c300f37e660378cd4fdc3071a289dbf4ffc9eab6f2c2f9b2a975c2a01192ce4e27ecb3160ff0ec14f47f3fedd9dffe1b7cbabf6d30e862d691e69a37b4ccb2f3b7706237d7105328814a624e5b4d28b772f8134d9392622a0fe48c98ed67ddcc6dc41b74efdedae3f7f030000ffffcaa2a8a50f030000
08-18 11:37:01.682 15333-16019/com.handshake.hsdm I/LiteCore [Actor]: inc->blips:myurl/db/_blipsync performNextMessage
08-18 11:37:01.682 15333-16019/com.handshake.hsdm W/LiteCore [Sync]: {180} Got invalid revision
08-18 11:37:01.682 15333-16019/com.handshake.hsdm I/LiteCoreJNI: [NATIVE] C4Replicator.documentErrorCallback() repl -> 0x0x777ef2a2a0, pulling, received invalid revision

Here’s the exact code we’re using:

URI uri = null;
try {
    uri = new URI(my_url");
} catch (URISyntaxException e) {
    e.printStackTrace();
}
ReplicatorConfiguration replConfig = new ReplicatorConfiguration(database, uri);
replConfig.setAuthenticator(new SessionAuthenticator(sessionInfo.cookieValue, sessionInfo.cookieDate, sessionInfo.cookieName));
replConfig.setContinuous(false);
replConfig.setReplicatorType(ReplicatorConfiguration.ReplicatorType.PULL);
replicator = new Replicator(replConfig);
replicator.addChangeListener(new ReplicatorChangeListener() {
    @Override
    public void changed(Replicator replicator, Replicator.Status status, CouchbaseLiteException error) {
        Log.d("GABE", "status "+status.getActivityLevel()+" prog total "+status.getProgress().getTotal()+" prog comp "+status.getProgress().getCompleted()+" error "+error);
        if ( error == null && status.getActivityLevel() == Replicator.ActivityLevel.STOPPED && status.getProgress().getTotal() == status.getProgress().getCompleted()) {
            if (replicatorListener != null) {
                replicatorListener.onFinished(true);
            }
        } else if (error != null) {
            replicatorListener.onFinished(false);
        }
    }
});
replicator.start();

The data looks good to us on the admin website. Diving into the source, “{%s} Got invalid revision” should only be sent if the revision or document id is 0 or empty, which shouldn’t be the case for any of our documents so far as we can tell.

Any help would be appreciated.

(Note: I also submitted a bug for a crash I found in SessionAuthenticator and will be submitting a fix for it. But this happens with BasicAuthenticator as well).

Make sure you’ve updated Sync Gateway 1.5 to the latest developer build. There was a change in the replication protocol that would cause this type of error if you updated CBL but not SG.

This does appear to be the problem. A miscommunication between the server and front end people. Thanks for the help!