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

Stack Overflow | Nukhba Arshad | 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

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

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

    RealmPrimaryKeyConstraintException: Value already exists: 0

    GitHub | 8 months ago | mehrdaad
    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 | 7 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:721)
    2. io.realm.internal.Table.addEmptyRowWithPrimaryKey(Table.java:473)
    2 frames
  3. io.realm
    Realm.copyToRealm
    1. io.realm.Realm.createObject(Realm.java:708)
    2. io.realm.fav_placesRealmProxy.copy(fav_placesRealmProxy.java:397)
    3. io.realm.fav_placesRealmProxy.copyOrUpdate(fav_placesRealmProxy.java:387)
    4. io.realm.DefaultRealmModuleMediator.copyOrUpdate(DefaultRealmModuleMediator.java:99)
    5. io.realm.Realm.copyOrUpdate(Realm.java:1272)
    6. io.realm.Realm.copyToRealm(Realm.java:727)
    6 frames
  4. com.nuku.mc
    realmHelper$1.execute
    1. com.nuku.mc.populate_recyclerview.realmHelper$1.execute(realmHelper.java:36)
    1 frame
  5. io.realm
    Realm.executeTransaction
    1. io.realm.Realm.executeTransaction(Realm.java:1065)
    1 frame
  6. com.nuku.mc
    placesAdapter$ViewHolder.onClick
    1. com.nuku.mc.populate_recyclerview.realmHelper.save(realmHelper.java:31)
    2. com.nuku.mc.populate_recyclerview.placesAdapter$ViewHolder.onClick(placesAdapter.java:159)
    2 frames
  7. Android Platform
    ActivityThread.main
    1. android.view.View.performClick(View.java:4212)
    2. android.view.View$PerformClick.run(View.java:17476)
    3. android.os.Handler.handleCallback(Handler.java:800)
    4. android.os.Handler.dispatchMessage(Handler.java:100)
    5. android.os.Looper.loop(Looper.java:194)
    6. android.app.ActivityThread.main(ActivityThread.java:5371)
    6 frames