io.realm.exceptions.RealmPrimaryKeyConstraintException: Value already exists: 0

GitHub | mehrdaad | 9 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    RealmPrimaryKeyConstraintException: Value already exists: 0

    GitHub | 9 months ago | mehrdaad
    io.realm.exceptions.RealmPrimaryKeyConstraintException: Value already exists: 0
  2. 0

    I want to add object to realm DB every time an item is clicked from the recyclerview

    Stack Overflow | 10 months ago | Nukhba Arshad
    io.realm.exceptions.RealmPrimaryKeyConstraintException: Value already exists: 0
  3. 0

    Realm : getTable() delete all then copyToRealm

    Stack Overflow | 1 year ago | Miguel Victor
    io.realm.exceptions.RealmPrimaryKeyConstraintException: Value already exists: 18
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    copyToRealmOrUpdate fails with RealmPrimaryKeyConstraintException: Value already exists

    GitHub | 8 months ago | chrisolsen
    io.realm.exceptions.RealmPrimaryKeyConstraintException: Value already exists: ahJkZXZ-Y2hyaXNjYW1wLTEzMTlyDAsSCHByb2dyYW1zDA

Root Cause Analysis

  1. io.realm.exceptions.RealmPrimaryKeyConstraintException

    Value already exists: 0

    at io.realm.internal.Table.throwDuplicatePrimaryKeyException()
  2. io.realm.internal
    Table.addEmptyRowWithPrimaryKey
    1. io.realm.internal.Table.throwDuplicatePrimaryKeyException(Table.java:727)
    2. io.realm.internal.Table.addEmptyRowWithPrimaryKey(Table.java:473)
    2 frames
  3. io.realm
    Realm.copyToRealm
    1. io.realm.Realm.createObject(Realm.java:701)
    2. io.realm.StepRealmProxy.copy(StepRealmProxy.java:301)
    3. io.realm.StepRealmProxy.copyOrUpdate(StepRealmProxy.java:291)
    4. io.realm.DefaultRealmModuleMediator.copyOrUpdate(DefaultRealmModuleMediator.java:99)
    5. io.realm.Realm.copyOrUpdate(Realm.java:1292)
    6. io.realm.Realm.copyToRealm(Realm.java:720)
    6 frames
  4. com.xyz.moorche
    RealmDatabase$3.execute
    1. com.xyz.moorche.android.database.RealmDatabase$3.execute(RealmDatabase.java:220)
    1 frame
  5. io.realm
    Realm$1.run
    1. io.realm.Realm$1.run(Realm.java:1187)
    1 frame
  6. io.realm.internal
    BgPriorityRunnable.run
    1. io.realm.internal.async.BgPriorityRunnable.run(BgPriorityRunnable.java:34)
    1 frame
  7. Java RT
    Thread.run
    1. java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
    2. java.util.concurrent.FutureTask.run(FutureTask.java:237)
    3. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
    4. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
    5. java.lang.Thread.run(Thread.java:818)
    5 frames