{"record":{"id":"a7d70fdeef7674ca","repo":"microg/GmsCore","slug":"integrityerrorcode-internal-error-a7d70f","errorCode":"IntegrityErrorCode.INTERNAL_ERROR","errorMessage":"Null packageName.","messagePattern":"Null packageName\\.","errorType":"error_code","errorClass":"StandardIntegrityException","httpStatus":null,"severity":"error","filePath":"vending-app/src/main/kotlin/com/google/android/finsky/integrityservice/IntegrityService.kt","lineNumber":107,"sourceCode":"\n    private var integrityData: PlayIntegrityData? = null\n\n    override fun requestDialog(bundle: Bundle, callback: IRequestDialogCallback) {\n        Log.d(TAG, \"Method (requestDialog) called but not implemented \")\n        requestAndShowDialog(bundle, callback)\n    }\n\n    override fun requestAndShowDialog(bundle: Bundle?, callback: IRequestDialogCallback?) {\n        Log.d(TAG, \"Not yet implemented: requestAndShowDialog\")\n    }\n\n    override fun requestIntegrityToken(request: Bundle, callback: IIntegrityServiceCallback) {\n        Log.d(TAG, \"Method (requestIntegrityToken) called\")\n        lifecycleScope.launchWhenCreated {\n            runCatching {\n                val packageName = request.getString(KEY_PACKAGE_NAME)\n                if (packageName == null) {\n                    throw StandardIntegrityException(IntegrityErrorCode.INTERNAL_ERROR, \"Null packageName.\")\n                }\n                integrityData = callerAppToIntegrityData(context, packageName)\n                if (integrityData?.allowed != true) {\n                    throw StandardIntegrityException(IntegrityErrorCode.INTERNAL_ERROR, \"Not allowed to request integrity token.\")\n                }\n                val playIntegrityEnabled = VendingPreferences.isDeviceAttestationEnabled(context)\n                if (!playIntegrityEnabled) {\n                    throw StandardIntegrityException(IntegrityErrorCode.INTERNAL_ERROR, \"API is disabled.\")\n                }\n                val nonceArr = request.getByteArray(KEY_NONCE)\n                if (nonceArr == null) {\n                    throw StandardIntegrityException(IntegrityErrorCode.INTERNAL_ERROR, \"Nonce missing.\")\n                }\n                if (nonceArr.size < 16) {\n                    throw StandardIntegrityException(IntegrityErrorCode.NONCE_TOO_SHORT, \"Nonce too short.\")\n                }\n                if (nonceArr.size >= 500) {\n                    throw StandardIntegrityException(IntegrityErrorCode.NONCE_TOO_LONG, \"Nonce too long.\")","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/vending-app/src/main/kotlin/com/google/android/finsky/integrityservice/IntegrityService.kt#L89-L125","documentation":"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.","triggerScenarios":"Calling the standard integrity API with a Bundle missing the KEY_PACKAGE_NAME extra.","commonSituations":"Manual Bundle construction omitting the package name; client library bug or version mismatch; bundle extras lost across IPC.","solutions":["Ensure the Play Integrity client library sets the package name extra in the request Bundle","Use the official Play Integrity API rather than hand-built Bundles","Update Google Play services and the integrity client library","Log/inspect the outgoing Bundle to verify required keys"],"exampleFix":"// before\nval request = Bundle() // missing package name\nintegrityManager.requestIntegrityToken(request, callback)\n// after\nval request = Bundle().apply { putString(\"package.name\", context.packageName) }\nintegrityManager.requestIntegrityToken(request, callback)","handlingStrategy":"validation","validationCode":"check(request.containsKey(\"package.name\")) { \"request Bundle missing package name\" }","typeGuard":"val packageName: String? = request.getString(\"package.name\")\nif (packageName.isNullOrEmpty()) return // abort before service call","tryCatchPattern":"try {\n    integrityManager.requestIntegrityToken(request, callback)\n} catch (e: StandardIntegrityException) {\n    if (e.statusCode == IntegrityErrorCode.INTERNAL_ERROR) Log.e(TAG, \"malformed integrity request\", e)\n}","preventionTips":["Use the official Play Integrity client to build request Bundles","Don't mutate or rebuild the client's request Bundle","Keep client library and Play services versions current"],"tags":["kotlin","play-integrity","bundle","missing-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"157c9d86ac46c195a86c2f15ab55c84036223f95","analyzedAt":"2026-09-06T17:27:33.892Z","contentChangedAt":"2026-09-06T17:27:33.892Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}