{"record":{"id":"f8305805b592d4b3","repo":"microg/GmsCore","slug":"missing-package-name-f83058","errorCode":null,"errorMessage":"Missing package name","messagePattern":"Missing package name","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"play-services-core/src/main/kotlin/org/microg/gms/games/FirstPartyGamesService.kt","lineNumber":34,"sourceCode":"import com.google.android.gms.common.internal.GetServiceRequest\nimport com.google.android.gms.common.internal.IGmsCallbacks\nimport com.google.android.gms.games.client.IPlayGamesCallbacks\nimport com.google.android.gms.games.client.IPlayGamesService\nimport com.google.android.gms.games.client.PlayGamesConsistencyTokens\nimport org.microg.gms.BaseService\nimport org.microg.gms.common.Constants\nimport org.microg.gms.common.GmsService\nimport org.microg.gms.common.GooglePackagePermission\nimport org.microg.gms.common.PackageUtils\nimport org.microg.gms.utils.warnOnTransactionIssues\n\nprivate const val TAG = \"PlayGamesService\"\nprivate val FIRST_PARTY_PACKAGES = setOf(Constants.GMS_PACKAGE_NAME, GAMES_PACKAGE_NAME)\n\nclass FirstPartyGamesService : BaseService(TAG, GmsService.GAMES) {\n    override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService) {\n        val packageName = PackageUtils.getAndCheckCallingPackageOrImpersonation(this, request.packageName)\n            ?: throw IllegalArgumentException(\"Missing package name\")\n        val callingPackageName = PackageUtils.getCallingPackage(this) ?: packageName\n        if (!PackageUtils.callerHasGooglePackagePermission(this, GooglePackagePermission.GAMES))\n            throw IllegalArgumentException(\"$callingPackageName does not have google games access\")\n        if (callingPackageName !in FIRST_PARTY_PACKAGES) throw IllegalArgumentException(\"$callingPackageName is not first-party\")\n        callback.onPostInitCompleteWithConnectionInfo(\n            CommonStatusCodes.SUCCESS,\n            PlayGamesServiceImpl(this, lifecycle, packageName),\n            ConnectionInfo()\n        )\n    }\n}\n\nclass PlayGamesServiceImpl(val context: Context, val lifecycle: Lifecycle, val packageName: String) : IPlayGamesService.Stub() {\n\n    override fun getGameCollection(callbacks: IPlayGamesCallbacks?, maxResults: Int, gameCollectionType: Int, z: Boolean, forceReload: Boolean) {\n        Log.d(TAG, \"Not yet implemented: getGameCollection($maxResults, $gameCollectionType, $z, $forceReload)\")\n        callbacks?.onData(DataHolder.empty(CommonStatusCodes.SUCCESS))\n    }","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/play-services-core/src/main/kotlin/org/microg/gms/games/FirstPartyGamesService.kt#L16-L52","documentation":"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.","triggerScenarios":"Binding to GmsService.GAMES via FirstPartyGamesService with a GetServiceRequest lacking packageName and no valid impersonation (e.g. no signature match with an allowed package).","commonSituations":"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.","solutions":["Provide request.packageName when binding","If relying on package impersonation, ensure the client's signature matches the impersonated package","Verify the calling app is installed and visible to the package manager"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"require(request.packageName != null) { \"packageName required for FirstPartyGamesService bind\" }","typeGuard":null,"tryCatchPattern":"try {\n  gamesClient.connect()\n} catch (e: IllegalArgumentException) {\n  when (e.message) {\n    \"Missing package name\" -> fixRequestPackageName()\n  }\n}","preventionTips":["Populate GetServiceRequest.packageName before binding","If impersonation is intended, verify signatures match the impersonated package","Prefer GamesConnectService/GamesService for third-party clients"],"tags":["play-games","package-validation","service-binding","android"],"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"}