microg/GmsCore · error · IllegalArgumentException

Missing package name

Error message

Missing package name

What it means

DynamicLinksService checks the caller's package with PackageUtils.getAndCheckCallingPackage before instantiating DynamicLinksServiceImpl. A null result means the request's package name is missing or unverifiable, so IllegalArgumentException("Missing package name") is thrown and the Dynamic Links API is not bound.

Source

Thrown at play-services-core/src/main/kotlin/org/microg/gms/firebase/dynamiclinks/DynamicLinksService.kt:41

import com.google.firebase.dynamiclinks.internal.ShortDynamicLinkImpl
import com.google.firebase.dynamiclinks.internal.WarningImpl
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import org.microg.gms.BaseService
import org.microg.gms.common.GmsService
import org.microg.gms.common.PackageUtils
import org.microg.gms.fido.core.map
import org.microg.gms.appinivite.utils.DynamicLinkUtils
import org.microg.gms.utils.singleInstanceOf
import org.microg.gms.utils.warnOnTransactionIssues
import java.net.URLEncoder

private const val TAG = "DynamicLinksService"

class DynamicLinksService : BaseService(TAG, GmsService.DYNAMIC_LINKS_API) {

    override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService) {
        val callingPackage = PackageUtils.getAndCheckCallingPackage(this, request.packageName) ?: throw IllegalArgumentException("Missing package name")
        callback.onPostInitComplete(0, DynamicLinksServiceImpl(this, callingPackage, lifecycle, request.extras), null)
    }

}

class DynamicLinksServiceImpl(private val context: Context, private val callingPackageName: String, override val lifecycle: Lifecycle, extras: Bundle?) : IDynamicLinksService.Stub(), LifecycleOwner {

    private val queue = singleInstanceOf { Volley.newRequestQueue(context) }

    override fun getDynamicLink(callback: IDynamicLinksCallbacks, link: String?) {
        Log.d(TAG, "getDynamicLink: callingPackageName: $callingPackageName link: $link")
        lifecycleScope.launchWhenCreated {
            try {
                if (link == null) {
                    throw RuntimeException("Missing link")
                }
                val linkUri = Uri.parse(link)
                if ("http" == linkUri.scheme || "https" == linkUri.scheme) {

View on GitHub (pinned to 157c9d86ac)

Solutions

  1. Pass the correct packageName in GetServiceRequest when binding
  2. Use the official/microG DynamicLinks client wrapper, which fills the request properly
  3. Check that the calling app is installed and its UID maps to the claimed package
Defensive patterns

Strategy: validation

Validate before calling

require(request.packageName != null) { "packageName required for DynamicLinksService bind" }

Try / catch

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

Prevention

When it happens

Trigger: Binding to GmsService.DYNAMIC_LINKS_API with a GetServiceRequest whose packageName is null, or a caller whose UID cannot be matched to the claimed package.

Common situations: Client SDK not setting the package name in the service request; spoofed/impersonated bind attempts rejected by the check; app running under a shared UID or instrumentation where the calling package cannot be resolved.

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