microg/GmsCore · error · IllegalArgumentException

Missing package name

Error message

Missing package name

What it means

ManagementService (Find My Device spot management) validates the requesting app's package in handleServiceRequest via PackageUtils.getAndCheckCallingPackage. If the resolved/verified calling package is null, it throws IllegalArgumentException("Missing package name") and refuses to bind the SpotManagement service implementation.

Source

Thrown at play-services-core/src/main/kotlin/org/microg/gms/findmydevice/spot/management/ManagementService.kt:43

import com.google.android.gms.findmydevice.spot.ImportGivenOwnerKeyRequest
import com.google.android.gms.findmydevice.spot.ImportRequiredOwnerKeysRequest
import com.google.android.gms.findmydevice.spot.SetOwnerKeyRequest
import com.google.android.gms.findmydevice.spot.SyncOwnerKeyRequest
import com.google.android.gms.findmydevice.spot.internal.ISpotManagementCallbacks
import com.google.android.gms.findmydevice.spot.internal.ISpotManagementService
import org.microg.gms.BaseService
import org.microg.gms.auth.AuthPrefs
import org.microg.gms.common.GmsService
import org.microg.gms.common.PackageUtils
import org.microg.gms.findmydevice.FEATURES
import org.microg.gms.utils.warnOnTransactionIssues

private const val TAG = "ManagementService"

class ManagementService : BaseService(TAG, GmsService.FIND_MY_DEVICE_SPOT) {
    override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService) {
        val packageName = PackageUtils.getAndCheckCallingPackage(this, request.packageName)
            ?: throw IllegalArgumentException("Missing package name")
        val spotManagementServiceImpl = SpotManagementServiceImpl(packageName, this, lifecycle)
        callback.onPostInitCompleteWithConnectionInfo(0, spotManagementServiceImpl.asBinder(), ConnectionInfo().apply {
            features = FEATURES
        })
    }
}

class SpotManagementServiceImpl(val packageName: String, val context: Context, override val lifecycle: Lifecycle) : ISpotManagementService.Stub(), LifecycleOwner {

    override fun getOwnerKey(callbacks: ISpotManagementCallbacks?, request: GetOwnerKeyRequest?) {
        Log.d(TAG, "Unimplement getOwnerKey: $request")
    }

    override fun setOwnerKey(callbacks: ISpotManagementCallbacks?, request: SetOwnerKeyRequest?) {
        Log.d(TAG, "Unimplement setOwnerKey: $request")
    }

    override fun importRequiredOwnerKeys(

View on GitHub (pinned to 157c9d86ac)

Solutions

  1. Set request.packageName to the caller's real package name before binding
  2. Ensure the calling app's package/UID is resolvable by the package manager (app actually installed, not a shell UID)
  3. If building a client, use the standard GmsClient bind path which populates the request correctly
Defensive patterns

Strategy: validation

Validate before calling

// client side, before binding
require(request.packageName != null) { "GetServiceRequest.packageName must be set" }

Try / catch

try {
  managementClient.connect()
} catch (e: IllegalArgumentException) {
  if (e.message == "Missing package name") fixRequestPackageName()
}

Prevention

When it happens

Trigger: A client binds to the FIND_MY_DEVICE_SPOT GmsService with a GetServiceRequest whose packageName is null or does not match the actual calling UID so getAndCheckCallingPackage returns null.

Common situations: Malformed or spoofed GetServiceRequest from a non-Google client; calling through a binder shim that drops the package name; testing the service directly without setting request.packageName.

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