Realm flexible sync throwing OtherSessionError

Hi there, I’m having problems with OtherSessionError in one of the users from my application. This error is currently only occurring to this user (that I’m aware) and it’s happening when it tries to open the realm connection and setup initial subscriptions for flexible sync.

The complete error is ending session with error: error bootstrapping new query: error while querying the state collection "state_mycollection": (BadValue) cannot compare to undefined (ProtocolErrorCode=201).

This collection is used as a relationship in another schema, so I checked if there was any undefined value in that collection, which wasn’t the case. I also tried checking inside mycollection for undefined values, but also didn’t find anything.

I tried searching for more information about this error in the documentation and didn’t find anything, so any help on that would be appreciated.

Hello @Rossicler_Junior ,

Are you using custom user data in your rules by any chance? For reference, we’ve seen errors like the above occur when 1.) a rule expression references custom user data, and 2.) custom user data is missing for a user that is trying to start a sync session.


Actually, yes, I do use user custom data in my realm app rules.

I checked and it is the case, but I’m still not sure why did that happen. The user did had a custom data, but for some reason that I’m unsure, the realm user id got changed somehow. Do you have any idea how is that possible? I checked the user createdAt and it is correct, so it isn’t supposed to be a new user.

Hey @Rossicler_Junior ,

Are you willing to share me your App ID (can find this via the URL of your app – feel free to DM me to avoid having it sit on the public forum)? From there, the team can take a deeper look into the issue and hopefully identify what’s happening.


This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.