microg/GmsCore · error · StandardIntegrityException

IntegrityErrorCode.INTERNAL_ERROR

IntegrityErrorCode.INTERNAL_ERROR

Error message

Null packageName.

What it means

requestIntegrityToken throws StandardIntegrityException with IntegrityErrorCode.INTERNAL_ERROR and message 'Null packageName.' when the request Bundle has no string under KEY_PACKAGE_NAME. Without the caller's package name the service cannot evaluate or attest the request, so it fails immediately.

Source

Thrown at vending-app/src/main/kotlin/com/google/android/finsky/integrityservice/IntegrityService.kt:107

    private var integrityData: PlayIntegrityData? = null

    override fun requestDialog(bundle: Bundle, callback: IRequestDialogCallback) {
        Log.d(TAG, "Method (requestDialog) called but not implemented ")
        requestAndShowDialog(bundle, callback)
    }

    override fun requestAndShowDialog(bundle: Bundle?, callback: IRequestDialogCallback?) {
        Log.d(TAG, "Not yet implemented: requestAndShowDialog")
    }

    override fun requestIntegrityToken(request: Bundle, callback: IIntegrityServiceCallback) {
        Log.d(TAG, "Method (requestIntegrityToken) called")
        lifecycleScope.launchWhenCreated {
            runCatching {
                val packageName = request.getString(KEY_PACKAGE_NAME)
                if (packageName == null) {
                    throw StandardIntegrityException(IntegrityErrorCode.INTERNAL_ERROR, "Null packageName.")
                }
                integrityData = callerAppToIntegrityData(context, packageName)
                if (integrityData?.allowed != true) {
                    throw StandardIntegrityException(IntegrityErrorCode.INTERNAL_ERROR, "Not allowed to request integrity token.")
                }
                val playIntegrityEnabled = VendingPreferences.isDeviceAttestationEnabled(context)
                if (!playIntegrityEnabled) {
                    throw StandardIntegrityException(IntegrityErrorCode.INTERNAL_ERROR, "API is disabled.")
                }
                val nonceArr = request.getByteArray(KEY_NONCE)
                if (nonceArr == null) {
                    throw StandardIntegrityException(IntegrityErrorCode.INTERNAL_ERROR, "Nonce missing.")
                }
                if (nonceArr.size < 16) {
                    throw StandardIntegrityException(IntegrityErrorCode.NONCE_TOO_SHORT, "Nonce too short.")
                }
                if (nonceArr.size >= 500) {
                    throw StandardIntegrityException(IntegrityErrorCode.NONCE_TOO_LONG, "Nonce too long.")

View on GitHub (pinned to 157c9d86ac)

Solutions

  1. Ensure the Play Integrity client library sets the package name extra in the request Bundle
  2. Use the official Play Integrity API rather than hand-built Bundles
  3. Update Google Play services and the integrity client library
  4. Log/inspect the outgoing Bundle to verify required keys

Example fix

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

Strategy: validation

Validate before calling

check(request.containsKey("package.name")) { "request Bundle missing package name" }

Type guard

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

Try / catch

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

Prevention

When it happens

Trigger: Calling the standard integrity API with a Bundle missing the KEY_PACKAGE_NAME extra.

Common situations: Manual Bundle construction omitting the package name; client library bug or version mismatch; bundle extras lost across IPC.

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/a7d70fdeef7674ca. Report an issue: GitHub.