microg/GmsCore · error · UserVerificationRequirement.UnsupportedUserVerificationRequirementException
User verification requirement ${attachment} not supported
Error message
User verification requirement ${attachment} not supported What it means
UserVerificationRequirement.fromString() maps a user-verification string ("required", "preferred", "discouraged") to the enum; other values throw UnsupportedUserVerificationRequirementException. (The parameter is confusingly named 'attachment' — copy-paste from Attachment.)
Source
Thrown at play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/UserVerificationRequirement.java:45
return value;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(toString());
}
@Hide
public static UserVerificationRequirement fromString(String attachment) throws UnsupportedUserVerificationRequirementException {
for (UserVerificationRequirement value : values()) {
if (value.value.equals(attachment)) return value;
}
throw new UnsupportedUserVerificationRequirementException("User verification requirement " + attachment + " not supported");
}
public static Creator<UserVerificationRequirement> CREATOR = new Creator<UserVerificationRequirement>() {
@Override
public UserVerificationRequirement createFromParcel(Parcel source) {
try {
return UserVerificationRequirement.fromString(source.readString());
} catch (UnsupportedUserVerificationRequirementException e) {
throw new RuntimeException(e);
}
}
@Override
public UserVerificationRequirement[] newArray(int size) {
return new UserVerificationRequirement[size];
}
};
View on GitHub (pinned to 157c9d86ac)
Solutions
- Pass exactly "required", "preferred", or "discouraged".
- Default missing JSON fields to "preferred" instead of the empty string.
- Validate against the enum's values() before calling fromString.
Example fix
// before
var uv = UserVerificationRequirement.fromString(json.optString("userVerification"));
// after
String uvStr = json.optString("userVerification", "preferred");
var uv = UserVerificationRequirement.fromString(uvStr); Defensive patterns
Strategy: validation
Validate before calling
Set<String> valid = new HashSet<>(java.util.Arrays.asList("required", "preferred", "discouraged"));
if (!valid.contains(uvStr)) uvStr = "preferred"; Try / catch
try { uv = UserVerificationRequirement.fromString(s); } catch (UnsupportedUserVerificationRequirementException e) { uv = UserVerificationRequirement.fromString("preferred"); } Prevention
- Default missing userVerification JSON fields to "preferred" instead of an empty string.
- Validate case-sensitive membership before parsing.
- Use enum constants when building request options in code.
When it happens
Trigger: Calling fromString with a value outside {"required","preferred","discouraged"}: typos like "optional", case mismatches ("Required"), or empty strings from missing JSON keys (optString returns "").
Common situations: Relying-party JSON with userVerification values from a newer or nonstandard spec; JSON lacking the userVerification field so an empty/default string gets parsed.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Transport ${transport} not supported
- Attachment ${attachment} not supported
- Attestation conveyance preference ${attachment} not supporte
- PublicKeyCredentialType ${type} not supported
- No response set.
AI-assisted analysis of microg/GmsCore@157c9d86ac (2026-09-06).
Data as JSON: /api/errors/d7ef504a2035af81.
Report an issue: GitHub.