david_cockburn
david_cockburn

Reputation: 1

Why am I receiving a 'Multiple Sync Agents' error and 'Client Reset Error'?

I am utilising the Template App, provided by MongoDB Realm, available here: https://www.mongodb.com/docs/atlas/app-services/reference/template-apps/ (swiftui.todo.flex).

I am using SwiftUI, with Swift.

The app works correctly, apart from one aspect - when I log in as 'User 1' (arbitrary reference) it is successful - then, if I log out, and log back in (on the same device - i.e. the iOS simulator) as 'User 2', the login is successful but then I receive a recurring error message which reads 'Automatic Client Reset Failed' and the code eventually crashes with the following:

Received: ERROR "User mismatch for client file identifier (IDENT)" (error_code=223, try_again=true, error_action=ClientReset)

libc++abi: terminating with uncaught exception of type realm::MultipleSyncAgents: Multiple sync agents attempted to join the same session

Realm documentation states the 'Multiple User Systems' is compatible with their product, and that there should be no issues operating multiple users on the same device.

Realm logs show a "ClientFileUserMismatch Error". I suspect that the app is trying to open the pre-existing Realm file using the new user's credentials, which is causing the error? But I'm unsure of how to resolve this - and I'm surprised that this error appears in their template code?

Can anyone assist me please?

Upvotes: 0

Views: 332

Answers (1)

Jay
Jay

Reputation: 35667

The error

Multiple sync agents attempted to join the same session

is caused by a few things but the bottom line is it will happen when an incompatible version of Realm Studio has the Realm file open at the same time as the app is attempting to access the file.

Realm SDK's have a back-end database format and the version of Realm Studio must match.

One way to tell if this is the issue is to open the app and run it first, then attempt to open it with Realm Studio and watch for any errors.

Upvotes: 0

Related Questions