BadChangeset Error with React Native

I performed a client reset, then saw at least once client stuck now with this error. The logs keep showing:

ending session with error: error running conversion pipeline against changeset 0 in integration: error converting changeset to server history batch: error generating object modifications: error generating post image: encountered error applying instruction to state: error applying instruction to object in table “Scene” with primary key ObjectID(“652d9be5e2ccfb30ef330715”) at field path ‘principals.3’: ArrayInsert.prior_size was 3 but built-up array was only of length 4 (ProtocolErrorCode=212)

Assumed with client reset mode: Realm.ClientResetMode.RecoverOrDiscardUnsyncedChanges at least in a fatal error like this would discard changes. But the clients device is stuck unable to sync.

Is there anyway I can handle this to force realm to discard changes when the default behaviour fails like this?

Hi, is this still happening? I was able to find your application from the error message and it seems like the user running into this has bypassed it and is syncing normally now.

That error is the server detecting that the client sent an invalid modification and it is being rejected. When this happens, the server will client reset the realm. If the “recovery” attempts to make the same illegal change, then it will fail again and it should fallback to client reset the device and drop the write that was illegal (it seems like this happened, but correct me if I am wrong).

As for “why did this happen?”, we don’t see this too much, but we can try to look into it. We are always fixing things in Realm and the SDKs, so it is best to first always ensure you are on the latest version of the SDK.



Thanks for the quick reply. So I think you’re right and a client reset is now being performed. But interestingly despite that, I’m continuing to see the error on any write he’s making with the same error. Which seems to suggest his device isn’t catching up with remote source. Would something as simple as dropping all subscriptions and resubscribing resolve it?


For anyone else looking to resolve this issue in future. I found as a workaround, removing all sync subscriptions and re-enabling them resolved the issue.