microg/GmsCore · error · IllegalArgumentException
$callingPackageName is not first-party
Error message
$callingPackageName is not first-party
What it means
FirstPartyGamesService additionally restricts callers to FIRST_PARTY_PACKAGES (com.google.android.gms and the Games package). If the caller passed the Google-package-permission check but its package name is not in that set, IllegalArgumentException("<pkg> is not first-party") is thrown.
Source
Thrown at play-services-core/src/main/kotlin/org/microg/gms/games/FirstPartyGamesService.kt:38
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))
}
override fun loadGames(callbacks: IPlayGamesCallbacks?, playerId: String?, maxResults: Int, z: Boolean, forceReload: Boolean) {
Log.d(TAG, "Not yet implemented: loadGames($playerId, $maxResults, $z, $forceReload)")
callbacks?.onData(DataHolder.empty(CommonStatusCodes.SUCCESS))View on GitHub (pinned to 157c9d86ac)
Solutions
- Use GamesService or GamesConnectService for non-first-party packages
- Ensure the binding package is one of FIRST_PARTY_PACKAGES (com.google.android.gms or the Games package name)
- Fix the client config to target the correct service action
Defensive patterns
Strategy: fallback
Validate before calling
val firstParty = setOf(Constants.GMS_PACKAGE_NAME, GAMES_PACKAGE_NAME)
require(context.packageName in firstParty) { "caller must be first-party" } Try / catch
try {
firstPartyGamesClient.connect()
} catch (e: IllegalArgumentException) {
if (e.message?.endsWith("is not first-party") == true) {
gamesConnectClient.connect()
}
} Prevention
- Confirm the binding package is com.google.android.gms or the Games package before using the first-party endpoint
- Route other packages to GamesService/GamesConnectService
- Keep client service-action configuration correct
When it happens
Trigger: A Google-permission-holding but non-first-party package binding to FirstPartyGamesService — rare, e.g. an internally signed test app or an app with the GAMES permission that is not com.google.android.gms/games.
Common situations: Internal Google-signed tools or modified clients hitting the first-party endpoint; misconfigured client pointing at the wrong GmsService variant.
Understand the failure class
Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.
Related errors
- $callingPackageName does not have google games access
- Missing package name
- Missing package name
- Missing package name
- Service not supported:
AI-assisted analysis of microg/GmsCore@157c9d86ac (2026-09-06).
Data as JSON: /api/errors/813c47db6addab8c.
Report an issue: GitHub.