microg/GmsCore · error · IllegalArgumentException
Missing package name
Error message
Missing package name
What it means
SmsRetrieverService.handleServiceRequest throws this IllegalArgumentException when PackageUtils.getAndCheckCallingPackage(this, request.packageName) returns null — the caller's package could not be resolved or failed the consistency check between the binder calling identity and the claimed package name in the GetServiceRequest.
Source
Thrown at play-services-auth-api-phone/core/src/main/kotlin/org/microg/gms/auth/phone/SmsRetrieverService.kt:40
import com.google.android.gms.common.internal.GetServiceRequest
import com.google.android.gms.common.internal.IGmsCallbacks
import org.microg.gms.BaseService
import org.microg.gms.common.GmsService
import org.microg.gms.common.PackageUtils
private const val TAG = "SmsRetrieverService"
private val FEATURES = arrayOf(
Feature("sms_retrieve", 1),
Feature("user_consent", 3)
)
class SmsRetrieverService : BaseService(TAG, GmsService.SMS_RETRIEVER) {
private val smsRetriever = SmsRetrieverCore(this, lifecycle)
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,
SmsRetrieverServiceImpl(smsRetriever, packageName, lifecycle),
ConnectionInfo().apply { features = FEATURES }
)
}
}
class SmsRetrieverServiceImpl(private val smsRetriever: SmsRetrieverCore, private val packageName: String, override val lifecycle: Lifecycle) :
ISmsRetrieverApiService.Stub(), LifecycleOwner {
override fun startSmsRetriever(callback: ISmsRetrieverResultCallback) {
Log.d(TAG, "startSmsRetriever()")
lifecycleScope.launchWhenStarted {
val status = try {
smsRetriever.startSmsRetriever(packageName)
Status.SUCCESSView on GitHub (pinned to 157c9d86ac)
Solutions
- Update the Google Play Services (client) library in the app so the GetServiceRequest carries a correct packageName
- Ensure the calling app is installed and its package name matches what it passes to the API
- If you maintain the service side, catch IllegalArgumentException in the binder path and return a status-code error to the client instead of crashing
- Test with the official play-services-auth-api-phone client rather than hand-rolled binder calls
Example fix
// before
val packageName = PackageUtils.getAndCheckCallingPackage(this, request.packageName)
?: throw IllegalArgumentException("Missing package name")
// after
val packageName = PackageUtils.getAndCheckCallingPackage(this, request.packageName)
if (packageName == null) {
callback.onPostInitComplete(CommonStatusCodes.ERROR, null, null)
return
} Defensive patterns
Strategy: try-catch
Try / catch
try { bindAndUseService() } catch (e: IllegalArgumentException) { Log.w(TAG, "Service rejected request: ${e.message}") } Prevention
- Use the official play-services-auth-api-phone client library
- Keep client library versions current
- Avoid hand-rolled GetServiceRequest binder calls in tests
When it happens
Trigger: A Google Play Services client binding to the SMS_RETRIEVER service without a resolvable calling package (null from getAndCheckCallingPackage), e.g. a malformed GetServiceRequest or a caller whose uid maps to no installed package.
Common situations: Outdated or mismatched play-services client library on the app side; instrumentation/test harnesses that bind without proper package attribution; modified/custom client builds that spoof or omit packageName.
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
- UID [
- No acceptable module " + moduleId + " found. Local version i
- ERROR_MISSING_INSTANCEID_SERVICE
- (String) res
- UnsupportedOperationException
AI-assisted analysis of microg/GmsCore@157c9d86ac (2026-09-06).
Data as JSON: /api/errors/3a6455b146b50256.
Report an issue: GitHub.