White screen - ClientFileExpired


We use realm (device-sync) with flexible-sync in our react-native app. This app is in production and used by a bunch of customers. Sometimes we get notified by customers that they get a white screen when they open the app. I guess this has something to do with the sync process. Looking into the logs, we noticed the following Error:

ClientFileExpired Error:
ending session with error: router encountered error: error performing history scan: error fetching next batch: access attempted to expired part of server history (ProtocolErrorCode=222)

Sadly, we did not find anything about this error in the docs. We thought about schema mismatch, but we are pretty sure there was no mismatch. In my device sync settings, I have a Client Max Offline Time of 30 days. Could it be that this error occurred when a customer was not online for 30 days and somehow the local realm file was expired ?

Hello @Sami_Karak ,

Welcome back to The MongoDB Community Forums! :wave:

I would advise you to bring this up with the Atlas chat support team . They may be able to check if anything on the Atlas side could have possibly caused this issue. In saying so, if a chat support is raised, please provide them with the following:

  1. Cluster link / name which experienced the issue
  2. Time & date including timezone for when it occurred
  3. Exact error message output
  4. App ID
  5. Any additional details that you think will help them point to the issue



I would also love to do that, but mongodb-atlas wants me to pay 150$ for reactivation of the support plan to only ask a question every 12 months. This does not make sense for us.

Maybe you can point me to the documentation of this error? Since this is custom error name by mongodb-atlas there should be some docs about this right ? I could not find any …

We start to get really frustrated about using realm device-sync for our project because by going further and further we only encounter more and more problems with this service. It just don’t seem to be stable enough as it is now. And we are starting to loose hope that it will be stable in the near future.

thanks in advance

Unfortunately, I cannot check what the issue is and as the error is related to your application and realm sync hence only Atlas chat support team will have more insight inside your Atlas account and services.

I believe you can ask questions even with the basic support plan which is free.

In general, ProtocolErrorCode=222 means Client file has expired.

You can check below link to learn more about sync error handling.