microg/GmsCore · error · StandardIntegrityException

IntegrityErrorCode.INTERNAL_ERROR

IntegrityErrorCode.INTERNAL_ERROR

Error message

Null packageName.

What it means

requestExpressIntegrityToken throws StandardIntegrityException with IntegrityErrorCode.INTERNAL_ERROR and message 'Null packageName.' when the request Bundle does not contain a package name string under KEY_PACKAGE_NAME. The service cannot identify the calling app without it, so it fails fast with an internal error code.

Source

Thrown at vending-app/src/main/kotlin/com/google/android/finsky/expressintegrityservice/ExpressIntegrityService.kt:271

                visitData?.updateAppIntegrityContent(context, System.currentTimeMillis(), "$TAG visited success.", true)
                callback?.onWarmResult(bundleOf(KEY_WARM_UP_SID to expressIntegritySession.sessionId))
            }.onFailure {
                val exception = it as? StandardIntegrityException ?: StandardIntegrityException(it.message)
                Log.w(TAG, "warm up has failed: code=${exception.code}, message=${exception.message}", exception)
                visitData?.updateAppIntegrityContent(context, System.currentTimeMillis(), "$TAG visited failed. ${exception.message}")
                callback?.onWarmResult(bundleOf(KEY_ERROR to exception.code))
            }
        }
    }

    override fun requestExpressIntegrityToken(bundle: Bundle, callback: IExpressIntegrityServiceCallback?) {
        Log.d(TAG, "requestExpressIntegrityToken bundle:$bundle")
        lifecycleScope.launchWhenCreated {
            runCatching {
                val callingPackageName = bundle.getString(KEY_PACKAGE_NAME)
                if (callingPackageName == null) {
                    throw StandardIntegrityException(IntegrityErrorCode.INTERNAL_ERROR, "Null packageName.")
                }
                visitData = callerAppToIntegrityData(context, callingPackageName)
                if (visitData?.allowed != true) {
                    throw StandardIntegrityException(IntegrityErrorCode.API_NOT_AVAILABLE, "Not allowed visit")
                }
                val playIntegrityEnabled = VendingPreferences.isDeviceAttestationEnabled(context)
                if (!playIntegrityEnabled) {
                    throw StandardIntegrityException(IntegrityErrorCode.API_NOT_AVAILABLE, "API is disabled")
                }

                val expressIntegritySession = ExpressIntegritySession(
                    packageName = callingPackageName,
                    cloudProjectNumber = bundle.getLong(KEY_CLOUD_PROJECT, 0L),
                    sessionId = Random.nextLong(),
                    requestHash = bundle.getString(KEY_NONCE),
                    originatingWarmUpSessionId = bundle.getLong(KEY_WARM_UP_SID, 0),
                    verdictOptOut = bundle.getIntegerArrayList(KEY_REQUEST_VERDICT_OPT_OUT),
                    webViewRequestMode = bundle.getInt(KEY_REQUEST_MODE, 0)

View on GitHub (pinned to 157c9d86ac)

Solutions

  1. Ensure the Play Integrity client sets the caller package name extra in the request Bundle
  2. Use the official Play Integrity library instead of constructing the Bundle manually
  3. Update Google Play services and the integrity client library on the device
  4. Log the request Bundle contents to confirm which key the service expects

Example fix

// before
val bundle = Bundle()
integrityManager.requestExpressIntegrityToken(bundle, callback)
// after
val bundle = Bundle().apply { putString("package.name", context.packageName) }
integrityManager.requestExpressIntegrityToken(bundle, callback)
Defensive patterns

Strategy: validation

Validate before calling

// caller side: ensure the package name extra is present before binding
check(bundle.containsKey("package.name")) { "request Bundle missing package name" }

Type guard

val packageName: String? = bundle.getString("package.name")
if (packageName.isNullOrEmpty()) return // abort before service call

Try / catch

try {
    integrityManager.requestExpressIntegrityToken(bundle, callback)
} catch (e: StandardIntegrityException) {
    if (e.statusCode == IntegrityErrorCode.INTERNAL_ERROR) Log.e(TAG, "malformed request", e)
}

Prevention

When it happens

Trigger: Calling express integrity API with a Bundle lacking the KEY_PACKAGE_NAME string extra.

Common situations: Client SDK bug or version mismatch where the package name extra is never set; bundle built manually without the required key; IPC marshalling dropped the extra.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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