microg/GmsCore · error · IllegalArgumentException

Missing package name

Error message

Missing package name

What it means

GamesConnectService validates the requesting package via PackageUtils.getAndCheckCallingPackage before constructing GamesConnectServiceImpl; a null result (missing or unverifiable package name in the GetServiceRequest) causes IllegalArgumentException("Missing package name") and the GAMES connect endpoint is not bound.

Source

Thrown at play-services-core/src/main/kotlin/org/microg/gms/games/GamesConnectService.kt:45

import com.google.android.gms.games.internal.connect.GamesSignInResponse
import com.google.android.gms.games.internal.connect.IGamesConnectCallbacks
import com.google.android.gms.games.internal.connect.IGamesConnectService
import org.microg.gms.BaseService
import org.microg.gms.auth.AuthConstants
import org.microg.gms.auth.AuthManager
import org.microg.gms.auth.AuthPrefs
import org.microg.gms.auth.signin.checkAccountAuthStatus
import org.microg.gms.common.GmsService
import org.microg.gms.common.PackageUtils
import org.microg.gms.utils.warnOnTransactionIssues
import java.util.UUID

private const val TAG = "GamesConnectService"

class GamesConnectService : BaseService(TAG, GmsService.GAMES) {
    override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService) {
        val packageName = PackageUtils.getAndCheckCallingPackage(this, request.packageName)
            ?: throw IllegalArgumentException("Missing package name")
        callback.onPostInitCompleteWithConnectionInfo(
            CommonStatusCodes.SUCCESS,
            GamesConnectServiceImpl(this, lifecycle, packageName),
            ConnectionInfo()
        )
    }
}

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

    override fun signIn(callback: IGamesConnectCallbacks?, request: GamesSignInRequest?) {
        Log.d(TAG, "signIn($request)")
        suspend fun sendSignInRequired() {
            val resolution = PendingIntentCompat.getActivity(context, packageName.hashCode(), Intent(context, GamesSignInActivity::class.java).apply {
                putExtra(EXTRA_GAME_PACKAGE_NAME, packageName)
                putExtra(EXTRA_ACCOUNT, GamesConfigurationService.getDefaultAccount(context, packageName))
                putExtra(EXTRA_SCOPES, arrayOf(Scope(Scopes.GAMES_LITE)))
            }, PendingIntent.FLAG_UPDATE_CURRENT, false)

View on GitHub (pinned to 157c9d86ac)

Solutions

  1. Set request.packageName to the caller's package before binding
  2. Use the standard microG/Play Games connect client which populates the request
  3. Confirm the app is installed and its UID matches the claimed package
Defensive patterns

Strategy: validation

Validate before calling

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

Try / catch

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

Prevention

When it happens

Trigger: Client binds to GmsService.GAMES (connect variant) with request.packageName null or not matching the calling UID.

Common situations: Hand-rolled GmsClient implementations not setting packageName; spoofed bind attempts; apps running under UIDs the package manager cannot attribute (shared userId, instrumentation).

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