ERROR: client file contained lastIntegratedServerVersion greater than the downloadServerVersion – (ProtocolErrorCode=209)

I’d like help debugging an error I received trying to open an old Realm file with slightly newer config after updating my production App Service configuration. When trying to open the Realm file (in my Electron app) I got the following error in my Electron logs:

Connection[1]: Session[1]: Received: ERROR "Bad server version (IDENT, UPLOAD)" (error_code=209, try_again=false, recovery_disabled=false)

Now, even though the connection was closed b/c of the error, I was still able to load the Realm data initially. I think this is because I have existingRealmFileBehavior in my sync config set to type: "openImmediately". But when there’s a “bad server error”, it closes the connection.

I also checked my App Service logs and found this error, which elaborates a little more:

client file contained lastIntegratedServerVersion(6668) greater than the downloadServerVersion(6662) sent in the IDENT message which is not allowed (ProtocolErrorCode=209)

What’s even stranger is that when I tried starting up my Electron app again (thus opening Realm file again), I got a NEW error in my Electron logs:

ERROR: Connection[1]: Session[1]: Failed to integrate downloaded changesets: Failed to parse, or apply received changeset: Update: No such object: Note in class '"a186caf5-4f6f-42e4-9084-bfb92182ff8f"' (instruction table: Note, version: 6264, last_integrated_remote_version: 1, origin_file_ident: 34, timestamp: 240171746598)

After getting this second error, the realm file appears to no longer contain the original data, and has been wiped clean. Looking at my App Service logs, I don’t see any errors that provide more information, I only see when the connection was opened and then immediately closed:

Reproducing the issue

I had a copy of the original realm file, and I’ve been able to reproduce this sequence of errors again and again. It seems like the first attempt somehow alters the realm file, but I’m not sure how.

More Context

I recently copied over the config from my development App Service (AS) config to my production one. This change included changes to the schema (additive changes – no breaking changes as far as I can tell).

Additionally, I have an older published version of my Electron app on another computer. It connects to the production AS without issue and is able to sync data just fine. The sync config on this older app is only slightly different that what I was using when the above errors occurred. The differences in the connection config were that I’m now using the updated schema, and my schema version has been bumped up.

Any help is much appreciated!