question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to open a realm at path

See original GitHub issue

Hi! Fabric is reporting a crash on one of our apps which is affecting a pretty high number of users and I have not been able to reproduce it or find a fix online. Has one got any tips on how I could go about fixing this issuse?

I have disabled automatic backup on the realm files but that didn’t happen to fix things.

Actual Results

Fatal Exception: io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/com.pitchero.ph/files/default.realm': Incompatible histories. Expected a Realm with no or in-realm history. (Incompatible histories. Expected a Realm with no or in-realm history) (/data/data/com.pitchero.ph/files/default.realm) in /Users/Nabil/Dev/realm/master/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 101 at io.realm.internal.OsSharedRealm.nativeGetSharedRealm(OsSharedRealm.java) at io.realm.internal.OsSharedRealm.<init>(OsSharedRealm.java:171) at io.realm.internal.OsSharedRealm.getInstance(OsSharedRealm.java:241) at io.realm.internal.OsSharedRealm.getInstance(OsSharedRealm.java:231) at io.realm.RealmCache.doCreateRealmOrGetFromCache(RealmCache.java:319) at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:282) at io.realm.Realm.getDefaultInstance(Realm.java:343) at com.pitchero.ph.utils.AppUtils.logout(AppUtils.java:29) at com.pitchero.ph.MainActivity$4.run(MainActivity.java:365) at android.app.Activity.runOnUiThread(Activity.java:5907) at com.pitchero.ph.MainActivity.goBackToIntroActivity(MainActivity.java:362) at com.pitchero.ph.MainActivity.access$300(MainActivity.java:73) at com.pitchero.ph.MainActivity$1.run(MainActivity.java:242) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:241) at android.app.ActivityThread.main(ActivityThread.java:6274) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

Steps & Code to Reproduce

I have not been able to reproduce the error, it’s something that is picked up by Fabric. I have recently disabled automatic back up for the realm files and I was hoping this will fix this error as well but it seems to still come up.

Code Sample

Version of Realm and tooling

Realm version(s): 5.0.1

Realm sync feature enabled: no

Android Studio version: 3.1.2

Which Android version and device: 5,6,7,8 - (unknown devices) - data from Fabric

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Zhuindencommented, Jun 7, 2018

Now is a good time for me to chime in and hope that this will gain some attention internally, as I apparently don’t have the C++ knowledge to modify the core: https://github.com/realm/realm-core/issues/2968

1reaction
cmelchiorcommented, Jun 7, 2018

Hi @tudorsirbu Unfortunately, there isn’t much we can do about this unless it can be reproduced. If you are able to send a Realm file that fails to open this way then we can investigate what is wrong with it, which might give some clues as to why it is happening.

But yes, my best guess is that something is that something other than Realm is manipulating the file.

With regards to a possible fix, then I don’t know what the Realm contains. If it is just a network cache, then you can catch that exception, delete the file and re-open the Realm. It would obviously mean users would have to download the data again, but at least it wouldn’t crash their app.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to open a realm at path - Stack Overflow
I tried to open the realm file using Realm's browser app and the file does not open anymore. It has now new permissions:...
Read more >
CRASH: Unable to open a realm at path · Issue #7129 - GitHub
Install live version of the app from App Store. Then run the app from Xcode or other testing service such as TestFlight. If...
Read more >
Unable to open a realm at path in Xamarin forms - MongoDB
I'm reading data from remote mongodb realm which sync's to my local realm, but it seems I can't read from my local realm...
Read more >
Realm Object Server Documentation
Open the realm-mobile-platform folder. You can start the Realm Object Server by double-clicking start-object-server.command . Linux. Under Linux, Realm's ...
Read more >
Minecraft: Java Edition Realms Troubleshooting
Try reverting to a previous save of your world through your Realm's backup menu. Switch the world slot and open a new world....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found