microg/GmsCore · error · UnsupportedAttestationConveyancePreferenceException
Attestation conveyance preference ${attachment} not supporte
Error message
Attestation conveyance preference ${attachment} not supported What it means
AttestationConveyancePreference.fromString() maps an attestation conveyance string ("none", "indirect", "direct", "enterprise") to the enum. Unrecognized values throw UnsupportedAttestationConveyancePreferenceException so bad attestation settings fail fast rather than being ignored.
Source
Thrown at play-services-fido/src/main/java/com/google/android/gms/fido/fido2/api/common/AttestationConveyancePreference.java:52
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(toString());
}
@Hide
@NonNull
public static AttestationConveyancePreference fromString(String attachment) throws UnsupportedAttestationConveyancePreferenceException {
for (AttestationConveyancePreference value : values()) {
if (value.value.equals(attachment)) return value;
}
throw new UnsupportedAttestationConveyancePreferenceException("Attestation conveyance preference " + attachment + " not supported");
}
public static Creator<AttestationConveyancePreference> CREATOR = new Creator<AttestationConveyancePreference>() {
@Override
public AttestationConveyancePreference createFromParcel(Parcel source) {
try {
return AttestationConveyancePreference.fromString(source.readString());
} catch (UnsupportedAttestationConveyancePreferenceException e) {
throw new RuntimeException(e);
}
}
@Override
public AttestationConveyancePreference[] newArray(int size) {
return new AttestationConveyancePreference[size];
}
};
View on GitHub (pinned to 157c9d86ac)
Solutions
- Use one of the supported strings exactly: "none", "indirect", "direct" (or "enterprise" if the enum defines it).
- Prefer the enum constants directly instead of parsing strings.
- Update the microG FIDO library if a newer preference value must be accepted.
Example fix
// before
var pref = AttestationConveyancePreference.fromString("attestation-direct");
// after
var pref = AttestationConveyancePreference.fromString("direct"); Defensive patterns
Strategy: validation
Validate before calling
boolean valid = java.util.Arrays.stream(AttestationConveyancePreference.values()).anyMatch(p -> p.toString().equals(preference)); if (!valid) preference = "none";
Try / catch
try { pref = AttestationConveyancePreference.fromString(value); } catch (UnsupportedAttestationConveyancePreferenceException e) { pref = AttestationConveyancePreference.fromString("none"); } Prevention
- Whitelist the accepted strings ("none", "indirect", "direct") before parsing.
- Default to "none" when the server value is unknown — attestation is optional.
- Use enum constants when constructing PublicKeyCredentialCreationOptions directly.
When it happens
Trigger: Calling fromString with a value outside the enum, e.g. a typo like "attestation-direct", the empty string, or a newer spec value not present in this library version. (The message text mistakenly says 'attachment' — it refers to the conveyance preference.)
Common situations: Server-issued WebAuthn options containing attestation values from a newer spec than the embedded library supports; hand-written option JSON in tests with case errors ("Direct").
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
- PublicKeyCredentialType ${type} not supported
- User verification requirement ${attachment} not supported
- No response set.
AI-assisted analysis of microg/GmsCore@157c9d86ac (2026-09-06).
Data as JSON: /api/errors/54a9c8665ab1a12c.
Report an issue: GitHub.