{"record":{"id":"9eccde2bd0d56d1e","repo":"microg/GmsCore","slug":"missing-package-name","errorCode":null,"errorMessage":"Missing package name","messagePattern":"Missing package name","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"play-services-ads/core/src/main/kotlin/org/microg/gms/ads/AdRequestService.kt","lineNumber":28,"sourceCode":"import android.util.Log\nimport com.google.android.gms.ads.internal.ExceptionParcel\nimport com.google.android.gms.ads.internal.NonagonRequestParcel\nimport com.google.android.gms.ads.internal.request.IAdRequestService\nimport com.google.android.gms.ads.internal.request.INonagonStreamingResponseListener\nimport com.google.android.gms.common.api.CommonStatusCodes\nimport 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\nimport org.microg.gms.utils.warnOnTransactionIssues\n\nprivate const val TAG = \"AdRequestService\"\n\nclass AdRequestService : BaseService(TAG, GmsService.ADMOB) {\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        val binder = AdRequestServiceImpl().asBinder()\n        callback.onPostInitComplete(CommonStatusCodes.SUCCESS, binder, Bundle())\n    }\n}\n\nclass AdRequestServiceImpl : IAdRequestService.Stub() {\n    override fun getAdRequest(request: NonagonRequestParcel, listener: INonagonStreamingResponseListener) {\n        Log.d(TAG, \"getAdRequest\")\n        listener.onException(ExceptionParcel().apply {\n            message = \"Not supported\"\n            code = CommonStatusCodes.INTERNAL_ERROR\n        })\n    }\n\n    override fun getSignals(request: NonagonRequestParcel, listener: INonagonStreamingResponseListener) {\n        Log.d(TAG, \"getSignals\")\n        listener.onException(ExceptionParcel().apply {\n            message = \"Not supported\"","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/play-services-ads/core/src/main/kotlin/org/microg/gms/ads/AdRequestService.kt#L10-L46","documentation":"AdRequestService.handleServiceRequest resolves the calling app's package name via PackageUtils.getAndCheckCallingPackage using the packageName supplied in the GetServiceRequest. If it cannot be resolved (null) — the caller is unknown, unverified, or supplied an empty/mismatched package — it throws IllegalArgumentException(\"Missing package name\") and refuses to bind the ad service.","triggerScenarios":"A client binds to the microG ADMOB (GmsService.ADMOB) service with a GetServiceRequest whose packageName is null/empty, or whose value does not match the actual calling package as verified against the OS (PackageUtils.getAndCheckCallingPackage returns null on mismatch or unresolvable caller).","commonSituations":"Client SDK passing a stale or spoofed packageName in the service request instead of relying on the real caller identity; app installed with a broken/unresolved package record; ad SDK and microG version mismatch causing the request to be built without the package field; security testing where the caller's signature isn't verified.","solutions":["Ensure the client SDK fills GetServiceRequest.packageName with the app's real package name (context.packageName)","Verify the calling app's package/signature is resolvable and consistent — reinstall the app if its package record is broken","Update the client ads SDK and microG to matching versions so the service request is constructed correctly","If you own the caller code, stop overriding packageName manually and let the SDK derive it from the context"],"exampleFix":"// before\nval request = GetServiceRequest().apply { /* packageName left unset */ }\n// after\nval request = GetServiceRequest().apply { packageName = context.packageName }","handlingStrategy":"validation","validationCode":"fun buildAdServiceRequest(context: Context): GetServiceRequest =\n  GetServiceRequest().apply {\n    packageName = context.packageName\n    require(packageName.isNotBlank()) { \"Calling package must be set\" }\n  }","typeGuard":"fun GetServiceRequest.hasValidPackageName(): Boolean =\n  !packageName.isNullOrBlank()","tryCatchPattern":"try {\n  adService.bindService(request)\n} catch (e: IllegalArgumentException) {\n  if (e.message == \"Missing package name\") {\n    Log.w(TAG, \"Set request.packageName from context.packageName and retry\")\n  } else throw e\n}","preventionTips":["Always populate GetServiceRequest.packageName with context.packageName — never leave it null or hardcode another app's id","Keep the ads client SDK and microG versions compatible so requests are built correctly","Reinstall/repair the app if its package record is unresolvable on the device"],"tags":["android","ads","ipc","validation"],"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"}