microg/GmsCore · error · IllegalStateException
Missing required properties: token
Error message
Missing required properties: token
What it means
ClearTokenRequest.Builder.build() requires the token property to have been set. If setToken(...) was never called, token is null and build() throws IllegalStateException naming the missing property. This is a standard AutoValue-style 'Missing required properties' guard.
Source
Thrown at play-services-auth/src/main/java/com/google/android/gms/auth/api/identity/ClearTokenRequest.java:54
ClearTokenRequest(@NonNull @Param(1) String token, @Nullable @Param(2) String sessionId) {
this.token = token;
this.sessionId = sessionId;
}
/**
* Returns a new {@link ClearTokenRequest.Builder}.
*/
public static ClearTokenRequest.Builder builder() {
return new ClearTokenRequest.Builder() {
@Nullable
private String token;
@Nullable
private String sessionId;
@Override
public ClearTokenRequest build() {
if (token == null) {
throw new IllegalStateException("Missing required properties: token");
}
return new ClearTokenRequest(token, sessionId);
}
@Override
public ClearTokenRequest.Builder setToken(@NonNull String token) {
this.token = token;
return this;
}
@Override
public ClearTokenRequest.Builder setSessionId(@Nullable String sessionId) {
this.sessionId = sessionId;
return this;
}
};
}
View on GitHub (pinned to 157c9d86ac)
Solutions
- Always call setToken(...) with a non-null token before build().
- If the token may be absent, check it first and skip building/sending the request entirely rather than building with a null token.
- Log a clear message when skipping so the missing-token path is debuggable.
Example fix
// before ClearTokenRequest req = ClearTokenRequest.builder().build(); // after if (token == null) return; // nothing to clear ClearTokenRequest req = ClearTokenRequest.builder().setToken(token).build();
Defensive patterns
Strategy: validation
Validate before calling
if (token == null || token.isEmpty()) { skipClearToken(); return; } Try / catch
try { req = ClearTokenRequest.builder().setToken(token).build(); } catch (IllegalStateException e) { log.warn("ClearTokenRequest missing token", e); } Prevention
- Call setToken immediately after builder() so it's never forgotten.
- Check token availability before entering the clear-token flow.
- Use a small wrapper function that takes a non-null token.
When it happens
Trigger: Calling ClearTokenRequest.builder().build() without a prior setToken(String) call.
Common situations: Conditionally skipping setToken because the token variable was null/empty (e.g. sign-out flow where the cached token is already gone); copying builder code and dropping the setToken line.
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
- Missing required properties: scopes
- Missing required properties: account
- deleteAll=true but keys are provided
- UID [
- Only one extension per type may be added
AI-assisted analysis of microg/GmsCore@157c9d86ac (2026-09-06).
Data as JSON: /api/errors/ff9acb14b768478b.
Report an issue: GitHub.