microg/GmsCore · error · IllegalStateException

Missing required properties: account

Error message

Missing required properties: account

What it means

RevokeAccessRequest.Builder.build() checks account after scopes; when scopes is set but setAccount(...) was never called, it throws IllegalStateException 'Missing required properties: account'. Revocation must be tied to a specific Google account.

Source

Thrown at play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/RevokeAccessRequest.java:60

        this.account = account;
        this.sessionId = sessionId;
    }

    /**
     * Returns a new {@link RevokeAccessRequest.Builder}.
     */
    @NonNull
    public static RevokeAccessRequest.Builder builder() {
        return new Builder() {
            private List<Scope> scopes;
            private Account account;
            private String sessionId;

            @NonNull
            @Override
            public RevokeAccessRequest build() {
                if (scopes == null) throw new IllegalStateException("Missing required properties: scopes");
                if (account == null) throw new IllegalStateException("Missing required properties: account");
                return new RevokeAccessRequest(scopes, account, sessionId);
            }

            @NonNull
            @Override
            public Builder setAccount(@NonNull Account account) {
                this.account = account;
                return this;
            }

            @NonNull
            @Override
            public Builder setScopes(@NonNull List<Scope> scopes) {
                this.scopes = scopes;
                return this;
            }

            @NonNull

View on GitHub (pinned to 157c9d86ac)

Solutions

  1. Resolve the account first (e.g. GoogleSignIn.getLastSignedInAccount(context)) and abort if null before building the request.
  2. Call setAccount(account) with the non-null Account before build().
  3. If no account exists, the revocation is meaningless — skip the API call and route the user to sign-in.

Example fix

// before
RevokeAccessRequest req = RevokeAccessRequest.builder().setScopes(scopes).build();
// after
Account account = GoogleSignIn.getLastSignedInAccount(context).getAccount();
if (account == null) return; // not signed in
RevokeAccessRequest req = RevokeAccessRequest.builder().setScopes(scopes).setAccount(account).build();
Defensive patterns

Strategy: validation

Validate before calling

Account account = GoogleSignIn.getLastSignedInAccount(context) != null ? GoogleSignIn.getLastSignedInAccount(context).getAccount() : null;
if (account == null) { routeToSignIn(); return; }

Try / catch

try { req = RevokeAccessRequest.builder().setScopes(scopes).setAccount(account).build(); } catch (IllegalStateException e) { log.warn("RevokeAccessRequest missing account", e); }

Prevention

When it happens

Trigger: RevokeAccessRequest.builder().setScopes(...).build() without setAccount(Account).

Common situations: The signed-in account is null (user not signed in, or GoogleSignIn.getLastSignedInAccount returned null) and the null was passed/skipped silently; ordering bugs where build() runs before account resolution completes.

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