Skip to content

[Bug]: CoreService$init$1.invokeSuspend — UniFFI API checksum mismatch (bitkit-core, Play 2.2.0) #983

@piotr-iohk

Description

@piotr-iohk

What happened?

Google Play Console reports a production crash when bitkit-core is initialized from CoreService, wrapped as to.bitkit.utils.AppError via ServiceQueue.

Play cluster label: to.bitkit.services.CoreService$init$1.invokeSuspend

Play report: https://play.google.com/console/u/1/developers/5690237613698939049/app/4973032799696771282/vitals/crashes/1aff0cc569d86d9339cd4bf28523295c/details?isUserPerceived=true&days=60

Root cause (deepest cause in stack):

java.lang.RuntimeException: UniFFI API checksum mismatch: try cleaning and rebuilding your project
  at com.synonym.bitkitcore.IntegrityCheckingUniffiLib.uniffiCheckApiChecksums (bitkitcore.android.kt:1481)
  at com.synonym.bitkitcore.IntegrityCheckingUniffiLib.<clinit> (bitkitcore.android.kt:1458)

This occurs during initDb in CoreService$init$1.invokeSuspend (bitkit-core DB init). A later call path (ActivityService.getgetActivities) surfaces NoClassDefFoundError because static init of the UniFFI lib failed (ExceptionInInitializerError).

Play Vitals (60-day window):

  • 4 events, low frequency (spikes ~Apr 8, Apr 11, May 2, May 17–18).
  • Versions: mostly 181 (2.2.0) (~3), 180 (2.1.2) (~1).
  • Android: API 28–31 in sample (not Android 15+).
  • Visibility: 100% foreground.

Priority: Lower than #980 / #981 / #982 (~80% of Play events) but actionable.

Expected behavior

  • CoreService / initDb must initialize bitkit-core without UniFFI checksum failure.
  • Activity and other core APIs must work; no crash when loading activities (getActivities).

Steps to Reproduce

TBD — no confirmed deterministic repro. Suggested investigation:

  1. Identify build where bitkit-core-android AAR/JNI does not match the Kotlin bindings shipped in the app.
  2. Reproduce on API 28–31 if possible.
  3. Clean rebuild and verify checksum passes locally.
  4. Check whether affected users upgraded from older versions without clean install.

Logs / Screenshots / Recordings

Play Console: https://play.google.com/console/u/1/developers/5690237613698939049/app/4973032799696771282/vitals/crashes/1aff0cc569d86d9339cd4bf28523295c/details?isUserPerceived=true&days=60

Full stack trace (most recent Play report):

Exception to.bitkit.utils.AppError:
  at to.bitkit.async.ServiceQueue$background$2.invokeSuspend (ServiceQueue.kt:42)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:34)
  at kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:100)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
  at java.lang.Thread.run (Thread.java:923)
Caused by to.bitkit.utils.AppError:
  at to.bitkit.async.ServiceQueue$background$2.invokeSuspend (ServiceQueue.kt:42)
  at to.bitkit.async.ServiceQueue$background$2.invoke (Unknown Source:8)
  at to.bitkit.async.ServiceQueue$background$2.invoke (Unknown Source:4)
  at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndspatched (Undispatched.kt:66)
  at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn (Undispatched.kt:43)
  at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext (Builders.common.kt:165)
  at kotlinx.coroutines.BuildersKt.withContext (Unknown Source:1)
  at to.bitkit.async.ServiceQueue.background (ServiceQueue.kt:37)
  at to.bitkit.async.ServiceQueue.background$default (ServiceQueue.kt:33)
  at to.bitkit.services.ActivityService.get-MERU0ug (CoreService.kt:311)
  at to.bitkit.services.ActivityService$getTxIdsInBoostTxIds$2.invokeSuspend (CoreService.kt:1241)
  at to.bitkit.services.ActivityService$getTxIdsInBoostTxIds$2.invoke (Unknown Source:8)
  at to.bitkit.services.ActivityService$getTxIdsInBoostTxIds$2.invoke (Unknown Source:4)
  at to.bitkit.async.ServiceQueue$background$2.invokeSuspend (ServiceQueue.kt:40)
Caused by java.lang.NoClassDefFoundError:
  at com.synonym.bitkitcore.RustBufferHelper$allocValue-VKZWuLQ$$inlined$uniffiRustCall$1.invoke (bitkitcore.android.kt:14299)
  at com.synonym.bitkitcore.RustBufferHelper$allocValue-VKZWuLQ$$inlined$uniffiRustCall$1.invoke (bitkitcore.android.kt:284)
  at com.synonym.bitkitcore.UniffiRustCallStatusHelper.withReference$lib_release (bitkitcore.android.kt:384)
  at com.synonym.bitkitcore.RustBufferHelper.allocValue-VKZWuLQ$lib_release (bitkitcore.android.kt:14300)
  at com.synonym.bitkitcore.FfiConverter$DefaultImpls.lowerIntoRustBuffer (bitkitcore.android.kt:216)
  at com.synonym.bitkitcore.FfiConverterRustBuffer$DefaultImpls.lowerIntoRustBuffer (bitkitcore.android.kt:245)
  at com.synonym.bitkitcore.FfiConverterOptionalTypeActivityFilter.lowerIntoRustBuffer (bitkitcore.android.kt:10874)
  at com.synonym.bitkitcore.FfiConverterOptionalTypeActivityFilter.lowerIntoRustBuffer (bitkitcore.android.kt:10874)
  at com.synonym.bitkitcore.FfiConverterRustBuffer$DefaultImpls.lower (bitkitcore.android.kt:247)
  at com.synonym.bitkitcore.FfiConverterOptionalTypeActivityFilter.lower (bitkitcore.android.kt:10874)
  at com.synonym.bitkitcore.FfiConverterOptionalTypeActivityFilter.lower (bitkitcore.android.kt:10874)
  at com.synonym.bitkitcore.Bitkitcore_androidKt$getActivities-mlCQyHI$$inlined$uniffiRustCallWithError$1.invoke (bitkitcore.android.kt:14299)
  at com.synonym.bitkitcore.Bitkitcore_androidKt$getActivities-mlCQyHI$$inlined$uniffiRustCallWithError$1.invoke (bitkitcore.android.kt:284)
  at com.synonym.bitkitcore.UniffiRustCallStatusHelper.withReference$lib_release (bitkitcore.android.kt:384)
  at com.synonym.bitkitcore.Bitkitcore_androidKt.getActivities-mlCQyHI (bitkitcore.android.kt:14317)
  at to.bitkit.services.ActivityService$get$2.invokeSuspend (CoreService.kt:312)
  at to.bitkit.services.ActivityService$get$2.invoke (Unknown Source:8)
  at to.bitkit.services.ActivityService$get$2.invoke (Unknown Source:4)
  at to.bitkit.async.ServiceQueue$background$2.invokeSuspend (ServiceQueue.kt:40)
Caused by java.lang.ExceptionInInitializerError:
  at com.synonym.bitkitcore.RustBufferHelper$allocValue-VKZWuLQ$$inlined$uniffiRustCall$1.invoke (bitkitcore.android.kt:14299)
  at com.synonym.bitkitcore.RustBufferHelper$allocValue-VKZWuLQ$$inlined$uniffiRustCall$1.invoke (bitkitcore.android.kt:284)
  at com.synonym.bitkitcore.UniffiRustCallStatusHelper.withReference$lib_release (bitkitcore.android.kt:384)
  at com.synonym.bitkitcore.RustBufferHelper.allocValue-VKZWuLQ$lib_release (bitkitcore.android.kt:14300)
  at com.synonym.bitkitcore.FfiConverterString.lower (bitkitcore.android.kt:3740)
  at com.synonym.bitkitcore.Bitkitcore_androidKt$initDb$$inlined$uniffiRustCallWithError$1.invoke (bitkitcore.android.kt:14299)
  at com.synonym.bitkitcore.Bitkitcore_androidKt$initDb$$inlined$uniffiRustCallWithError$1.invoke (bitkitcore.android.kt:284)
  at com.synonym.bitkitcore.UniffiRustCallStatusHelper.withReference$lib_release (bitkitcore.android.kt:384)
  at com.synonym.bitkitcore.Bitkitcore_androidKt.initDb (bitkitcore.android.kt:14336)
  at to.bitkit.services.CoreService$init$1.invokeSuspend (CoreService.kt:128)
  at to.bitkit.services.CoreService$init$1.invoke (Unknown Source:8)
  at to.bitkit.services.CoreService$init$1.invoke (Unknown Source:4)
  at to.bitkit.async.ServiceQueue$blocking$1.invokeSuspend (ServiceQueue.kt:28)
Caused by java.lang.RuntimeException: UniFFI API checksum mismatch: try cleaning and rebuilding your project
  at com.synonym.bitkitcore.IntegrityCheckingUniffiLib.uniffiCheckApiChecksums (bitkitcore.android.kt:1481)
  at com.synonym.bitkitcore.IntegrityCheckingUniffiLib.<clinit> (bitkitcore.android.kt:1458)

Bitkit Version

2.2.0 (181) mostly, some 2.1.2 (180), mainnet to.bitkit. Native dep at v2.2.0 tag: bitkit-core-android 0.1.56.

Device / OS

Android 9 / 11 / 12 (SDK 28–31). Devices: Premio X70-2021, LG mcv5a, others.

Reproducibility

Rarely (once or twice)

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions