microg/GmsCore · error · IllegalArgumentException

Missing package name

Error message

Missing package name

What it means

FirstPartyGamesService resolves the caller package (allowing impersonation) with getAndCheckCallingPackageOrImpersonation; if that returns null it throws IllegalArgumentException("Missing package name") and refuses to serve the Play Games API. The impersonation fallback requires the request to be valid, so null means neither a real nor an impersonated package could be established.

Source

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

import com.google.android.gms.common.internal.GetServiceRequest
import com.google.android.gms.common.internal.IGmsCallbacks
import com.google.android.gms.games.client.IPlayGamesCallbacks
import com.google.android.gms.games.client.IPlayGamesService
import com.google.android.gms.games.client.PlayGamesConsistencyTokens
import org.microg.gms.BaseService
import org.microg.gms.common.Constants
import org.microg.gms.common.GmsService
import org.microg.gms.common.GooglePackagePermission
import org.microg.gms.common.PackageUtils
import org.microg.gms.utils.warnOnTransactionIssues

private const val TAG = "PlayGamesService"
private val FIRST_PARTY_PACKAGES = setOf(Constants.GMS_PACKAGE_NAME, GAMES_PACKAGE_NAME)

class FirstPartyGamesService : BaseService(TAG, GmsService.GAMES) {
    override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService) {
        val packageName = PackageUtils.getAndCheckCallingPackageOrImpersonation(this, request.packageName)
            ?: throw IllegalArgumentException("Missing package name")
        val callingPackageName = PackageUtils.getCallingPackage(this) ?: packageName
        if (!PackageUtils.callerHasGooglePackagePermission(this, GooglePackagePermission.GAMES))
            throw IllegalArgumentException("$callingPackageName does not have google games access")
        if (callingPackageName !in FIRST_PARTY_PACKAGES) throw IllegalArgumentException("$callingPackageName is not first-party")
        callback.onPostInitCompleteWithConnectionInfo(
            CommonStatusCodes.SUCCESS,
            PlayGamesServiceImpl(this, lifecycle, packageName),
            ConnectionInfo()
        )
    }
}

class PlayGamesServiceImpl(val context: Context, val lifecycle: Lifecycle, val packageName: String) : IPlayGamesService.Stub() {

    override fun getGameCollection(callbacks: IPlayGamesCallbacks?, maxResults: Int, gameCollectionType: Int, z: Boolean, forceReload: Boolean) {
        Log.d(TAG, "Not yet implemented: getGameCollection($maxResults, $gameCollectionType, $z, $forceReload)")
        callbacks?.onData(DataHolder.empty(CommonStatusCodes.SUCCESS))
    }

View on GitHub (pinned to 157c9d86ac)

Solutions

  1. Provide request.packageName when binding
  2. If relying on package impersonation, ensure the client's signature matches the impersonated package
  3. Verify the calling app is installed and visible to the package manager
Defensive patterns

Strategy: validation

Validate before calling

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

Try / catch

try {
  gamesClient.connect()
} catch (e: IllegalArgumentException) {
  when (e.message) {
    "Missing package name" -> fixRequestPackageName()
  }
}

Prevention

When it happens

Trigger: Binding to GmsService.GAMES via FirstPartyGamesService with a GetServiceRequest lacking packageName and no valid impersonation (e.g. no signature match with an allowed package).

Common situations: Custom game clients impersonating Play Games without the required signature; broken client that sends an empty package name; running the service from a test harness without a package context.

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