microg/GmsCore · error · IllegalArgumentException

Required account information missing

Error message

Required account information missing

What it means

AskPermissionActivity's verify() validates the intent extras before showing the consent UI. If accountName, accountType, or the derived Account is null, it throws IllegalArgumentException because the permission request cannot proceed without a target account.

Source

Thrown at play-services-core/src/main/java/org/microg/gms/auth/AskPermissionActivity.java:105

                service = intent.getStringExtra(KEY_AUTHTOKEN);
                callerUid = intent.getIntExtra(KEY_CALLER_UID, 0);
                callerPid = intent.getIntExtra(KEY_CALLER_PID, 0);
                fromAccountManager = intent.hasExtra(EXTRA_FROM_ACCOUNT_MANAGER);
                if (intent.hasExtra(EXTRA_CONSENT_DATA)) {
                    try {
                        consentData = ConsentData.ADAPTER.decode(intent.getByteArrayExtra(EXTRA_CONSENT_DATA));
                    } catch (Exception e) {
                        Log.w(TAG, "ConsentData decode failed", e);
                    }
                }
            }
            if (accountName != null && accountType != null) {
                account = new Account(accountName, accountType);
            }
        }

        private void verify(Context context) throws Exception {
            if (accountName == null || accountType == null || account == null) throw new IllegalArgumentException("Required account information missing");
            if (packageName == null || service == null) throw new IllegalArgumentException("Required request information missing");
            if (callerUid == 0) throw new IllegalArgumentException("Required caller information missing");
            PackageUtils.getAndCheckPackage(context, packageName, callerUid, callerPid);

            PackageManager packageManager = context.getPackageManager();
            ApplicationInfo applicationInfo = packageManager.getApplicationInfo(packageName, 0);
            appLabel = packageManager.getApplicationLabel(applicationInfo);
            appIcon = packageManager.getApplicationIcon(applicationInfo);
        }
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.ask_permission);
        data = new IntentData(getIntent());
        try {
            data.verify(this);

View on GitHub (pinned to 157c9d86ac)

Solutions

  1. Populate both the account name and account type extras in the launching intent before startActivity.
  2. Verify the Account exists via AccountManager.get(context).getAccountByName-equivalent before launching.
  3. Null-check extras in the calling code and fail early with a clear error.
  4. Use the library's intent-builder helpers if available so all required extras are set.

Example fix

// before
Intent i = new Intent(context, AskPermissionActivity.class); // no account extras
startActivity(i);
// after
Intent i = new Intent(context, AskPermissionActivity.class);
i.putExtra(KEY_ACCOUNT_NAME, account.name);
i.putExtra(KEY_ACCOUNT_TYPE, account.type);
startActivity(i);
Defensive patterns

Strategy: validation

Validate before calling

if (account == null || account.name == null || account.type == null) throw new IllegalArgumentException("account extras required before launching AskPermissionActivity");

Type guard

if (intent.getStringExtra(KEY_ACCOUNT_NAME) == null || intent.getStringExtra(KEY_ACCOUNT_TYPE) == null) return false;

Try / catch

try { verify(context); } catch (IllegalArgumentException e) { finish(); // show 'missing account' error to caller }

Prevention

When it happens

Trigger: Starting AskPermissionActivity with an intent missing the account name and/or account type extras, so Account fields are never populated.

Common situations: Constructing the auth intent manually without all required extras; a caller passing null account because AccountManager returned an unknown account; refactored code dropping extras.

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