microg/GmsCore · critical · RuntimeException

Failed to retrieve client information.

Error message

Failed to retrieve client information.

What it means

createIAPCore calls createClient(context, pkgName) to build the client-info object for the calling package; null triggers this RuntimeException. It means the caller's package information could not be resolved, so a valid IAP client cannot be created.

Source

Thrown at vending-app/src/main/java/org/microg/vending/billing/InAppBillingServiceImpl.kt:173

                ).requestAuthProofToken(password)
            }
            return runBlocking { deferred.await() }
        }

        private fun createIAPCore(context: Context, account: Account, pkgName: String): IAPCore {
            val key = "$pkgName:${account.name}"
            val cacheEntry = iapCoreCacheMap[key]
            if (cacheEntry != null) {
                if (cacheEntry.expiredAt > System.currentTimeMillis())
                    return cacheEntry.iapCore
                iapCoreCacheMap.remove(key)
            }
            val authData = AuthManager.getAuthData(context, account)
                ?: throw RuntimeException("Failed to obtain login token.")
            val deviceEnvInfo = createDeviceEnvInfo(context)
                ?: throw RuntimeException("Failed to retrieve device information.")
            val clientInfo = createClient(context, pkgName)
                ?: throw RuntimeException("Failed to retrieve client information.")
            val iapCore = IAPCore(context.applicationContext, deviceEnvInfo, clientInfo, authData)
            iapCoreCacheMap[key] =
                IAPCoreCacheEntry(iapCore, System.currentTimeMillis() + EXPIRE_MS)
            return iapCore
        }
    }

    private fun getPreferredAccount(extraParams: Bundle?): Account {
        val name = extraParams?.getString("accountName")
        name?.let {
            extraParams.remove("accountName")
        }
        return getGoogleAccount(context, name)
            ?: throw RuntimeException("No Google account found.")
    }

    private fun isBillingSupported(
        apiVersion: Int,

View on GitHub (pinned to 157c9d86ac)

Solutions

  1. Ensure the calling app is installed and passes its correct package name through the billing extras.
  2. Verify the app is visible to the service (package visibility / QUERY_ALL_PACKAGES or explicit queries on Android 11+).
  3. Reinstall the calling app so signature/package info is available.
  4. Catch the RuntimeException in the service boundary and return a proper billing error response code instead of crashing.

Example fix

// before
val skuDetails = billing.getSkuDetails(api, pkg, type, extras)
// after
if (context.packageManager.getLaunchIntentForPackage(pkg) == null) {
    return BillingError.UNKNOWN_ERROR // fail fast before remote call
}
val skuDetails = billing.getSkuDetails(api, pkg, type, extras)
Defensive patterns

Strategy: validation

Validate before calling

try {
    context.packageManager.getPackageInfo(callerPkg, 0)
} catch (e: PackageManager.NameNotFoundException) {
    return BillingError.UNKNOWN_ERROR // caller package resolvable before IAP call
}

Type guard

fun Context.canResolvePackage(pkg: String): Boolean =
    runCatching { packageManager.getPackageInfo(pkg, 0) }.isSuccess

Try / catch

try {
    billing.consumePurchase(...)
} catch (e: RuntimeException) {
    if (e.message?.contains("client information") == true) reportBadCallerPackage()
    else throw e
}

Prevention

When it happens

Trigger: Any billing call through createIAPCore with a pkgName whose PackageInfo/signature can't be resolved — e.g. the calling package is not installed, is untracked, or package-manager lookups fail.

Common situations: Caller package name typo/not passed in extras; calling app uninstalled or a shadow/instant install; microG lacks signature/package data for the caller; package manager restrictions on some ROMs.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of microg/GmsCore@157c9d86ac (2026-09-06). Data as JSON: /api/errors/8fd1ee96f0d653a2. Report an issue: GitHub.