Skip to content

Caused by: java.lang.IllegalStateException: No DB catalog present #1169

Description

@whatshappen

Code:

val file = File(SDCardUtils.getSDCardPathByEnvironment() + "/CustomFile/dbFile")
if (!file.exists()) {
file.exists()
}
MyObjectBox.builder()
.androidContext(context.applicationContext)
.directory(file)
.build()

Error:

at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3909)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4062)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2415)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:211)
at android.os.Looper.loop(Looper.java:300)
at android.app.ActivityThread.main(ActivityThread.java:8401)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:559)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)
Caused by: java.lang.IllegalStateException: No DB catalog present
at io.objectbox.BoxStore.nativeCreateWithFlatOptions(Native Method)
at io.objectbox.BoxStore.(BoxStore.java:271)
at io.objectbox.BoxStoreBuilder.build(BoxStoreBuilder.java:591)

Activity

  1. whatshappen commented on Jan 21, 2024

    @whatshappen
    Author

    机型:xiaomi 手机

  2. greenrobot-team commented on Jan 22, 2024

    @greenrobot-team
    Member

    Thanks for reporting! To help us diagnose this issue, please answer some questions. How often does this occur? Does this only occur on that device model? What version of ObjectBox is used? What version of Android is used?

    See the comment in #865 for potential solutions. As the file is on an SD card this might be a case of file corruption.

  3. whatshappen commented on Jan 23, 2024

    @whatshappen
    Author

    crash:100%
    current only xiaomi device
    objectbox.gradle version:3.7.1
    io.objectbox:objectbox-kotlin:3.7.1
    Android13

  4. greenrobot-team commented on Jan 23, 2024

    @greenrobot-team
    Member

    @whatshappen Thanks! Does the app use multiple processes by any chance?

  5. whatshappen commented on Jan 24, 2024

    @whatshappen
    Author

    @whatshappen Thanks! Does the app use multiple processes by any chance?

    no,init crash, is main thread

  6. 360060316 commented on Apr 16, 2025

    @360060316

    I have also encountered this issue. Please fix it as soon as possible. Xiaomi 9 is normal, Xiaomi 10 is not normal, and Xiaomi 11 is normal

  7. 360060316 commented on Apr 16, 2025

    @360060316

    Copy the database file from the phone that does not report an error to the phone that reports an error, and it can be used normally

  8. greenrobot-team commented on Apr 28, 2025

    @greenrobot-team
    Member

    @360060316 Is it possible that the database file is corrupted due to a file system issue? This would explain the error message.

    In this case the only option is to catch the above exception, delete the database files and then try to open a new BoxStore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions