{"record":{"id":"3a6455b146b50256","repo":"microg/GmsCore","slug":"missing-package-name-3a6455","errorCode":null,"errorMessage":"Missing package name","messagePattern":"Missing package name","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"play-services-auth-api-phone/core/src/main/kotlin/org/microg/gms/auth/phone/SmsRetrieverService.kt","lineNumber":40,"sourceCode":"import com.google.android.gms.common.internal.GetServiceRequest\nimport com.google.android.gms.common.internal.IGmsCallbacks\nimport org.microg.gms.BaseService\nimport org.microg.gms.common.GmsService\nimport org.microg.gms.common.PackageUtils\n\n\nprivate const val TAG = \"SmsRetrieverService\"\nprivate val FEATURES = arrayOf(\n    Feature(\"sms_retrieve\", 1),\n    Feature(\"user_consent\", 3)\n)\n\nclass SmsRetrieverService : BaseService(TAG, GmsService.SMS_RETRIEVER) {\n    private val smsRetriever = SmsRetrieverCore(this, lifecycle)\n\n    override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService) {\n        val packageName = PackageUtils.getAndCheckCallingPackage(this, request.packageName)\n            ?: throw IllegalArgumentException(\"Missing package name\")\n        callback.onPostInitCompleteWithConnectionInfo(\n            CommonStatusCodes.SUCCESS,\n            SmsRetrieverServiceImpl(smsRetriever, packageName, lifecycle),\n            ConnectionInfo().apply { features = FEATURES }\n        )\n    }\n}\n\n\nclass SmsRetrieverServiceImpl(private val smsRetriever: SmsRetrieverCore, private val packageName: String, override val lifecycle: Lifecycle) :\n    ISmsRetrieverApiService.Stub(), LifecycleOwner {\n\n    override fun startSmsRetriever(callback: ISmsRetrieverResultCallback) {\n        Log.d(TAG, \"startSmsRetriever()\")\n        lifecycleScope.launchWhenStarted {\n            val status = try {\n                smsRetriever.startSmsRetriever(packageName)\n                Status.SUCCESS","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/play-services-auth-api-phone/core/src/main/kotlin/org/microg/gms/auth/phone/SmsRetrieverService.kt#L22-L58","documentation":"SmsRetrieverService.handleServiceRequest throws this IllegalArgumentException when PackageUtils.getAndCheckCallingPackage(this, request.packageName) returns null — the caller's package could not be resolved or failed the consistency check between the binder calling identity and the claimed package name in the GetServiceRequest.","triggerScenarios":"A Google Play Services client binding to the SMS_RETRIEVER service without a resolvable calling package (null from getAndCheckCallingPackage), e.g. a malformed GetServiceRequest or a caller whose uid maps to no installed package.","commonSituations":"Outdated or mismatched play-services client library on the app side; instrumentation/test harnesses that bind without proper package attribution; modified/custom client builds that spoof or omit packageName.","solutions":["Update the Google Play Services (client) library in the app so the GetServiceRequest carries a correct packageName","Ensure the calling app is installed and its package name matches what it passes to the API","If you maintain the service side, catch IllegalArgumentException in the binder path and return a status-code error to the client instead of crashing","Test with the official play-services-auth-api-phone client rather than hand-rolled binder calls"],"exampleFix":"// before\nval packageName = PackageUtils.getAndCheckCallingPackage(this, request.packageName)\n    ?: throw IllegalArgumentException(\"Missing package name\")\n// after\nval packageName = PackageUtils.getAndCheckCallingPackage(this, request.packageName)\nif (packageName == null) {\n    callback.onPostInitComplete(CommonStatusCodes.ERROR, null, null)\n    return\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { bindAndUseService() } catch (e: IllegalArgumentException) { Log.w(TAG, \"Service rejected request: ${e.message}\") }","preventionTips":["Use the official play-services-auth-api-phone client library","Keep client library versions current","Avoid hand-rolled GetServiceRequest binder calls in tests"],"tags":["android","play-services","ipc","package-name"],"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"}